Skip to content

Commit 3633560

Browse files
Continuous voice in/out in webapp. App now default.
Refactoring. Other minor fixes and tweaks.
2 parents 107f457 + 81e9a4e commit 3633560

24 files changed

+1607
-426
lines changed

README.md

+48-26
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div align="center">
22

3-
[![pyrobbot-logo](./pyrobbot/app/data/assistant_avatar.png)]((https://github.com/paulovcmedeiros/pyRobBot))
3+
[![pyrobbot-logo](https://github.com/paulovcmedeiros/pyRobBot/blob/main/pyrobbot/app/data/assistant_avatar.png?raw=true)]((https://github.com/paulovcmedeiros/pyRobBot))
44
# <code>[pyRobBot](https://github.com/paulovcmedeiros/pyRobBot)</code><br>Chat with GPT LLMs over voice, UI & terminal.<br>All with access to the internet.
55

66
[![Pepy Total Downlods](https://img.shields.io/pepy/dt/pyrobbot?style=flat&label=Downloads)](https://www.pepy.tech/projects/pyrobbot)
77
[![PyPI - Version](https://img.shields.io/pypi/v/pyrobbot)](https://pypi.org/project/pyrobbot/)
88
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://pyrobbot.streamlit.app)
9-
[<img src="./pyrobbot/app/data/powered-by-openai-badge-outlined-on-dark.svg" width="100">](https://openai.com/blog/openai-api)
9+
[<img src="https://raw.githubusercontent.com/paulovcmedeiros/pyRobBot/107f4576463d56b8d55bd913a56507940a37b675/pyrobbot/app/data/powered-by-openai-badge-outlined-on-dark.svg" width="100">](https://openai.com/blog/openai-api)
1010

1111

1212
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
@@ -18,36 +18,42 @@
1818
</div>
1919

2020
PyRobBot is a python package that uses OpenAI's [GPT large language models (LLMs)](https://platform.openai.com/docs/models) to implement:
21-
* A fully configurable **personal assistant** that can speak and listen to you
21+
* A fully configurable **personal assistant** that can speak and listen to you using AI-generated **human-like voices**
2222
* An equally fully configurable text-based **chatbot** that can be used either via web UI or terminal
2323

2424

2525
## Features
26-
- [x] Personal assistant with text-to-speech and speech-to-text capabilities
27-
- Talk to the GPT assistant and the assistant will talk back to you!
28-
- Choose your preferred language (e.g., `rob --lang pt-br`)
29-
- Choose your preferred Text-to-Speech (TTS) engine (e.g., `rob --tts google`)
30-
- [OpenAI Text-to-Speech](https://platform.openai.com/docs/guides/text-to-speech) (default): AI-generated *human-like* voice
31-
- [Google TTS](https://cloud.google.com/text-to-speech): free at the time being, with decent quality
32-
- Choose your preferred Speech-to-Text (STT) engine
33-
- Also between OpenAI and Google (default)
26+
27+
Features include, but are not limited to:
28+
29+
- [x] Voice Chat
30+
- Continuous voice input and output
31+
- No need to press a button: the assistant will keep listening until you stop talking
32+
33+
- [x] Internet access: The assistent will **search the web** to find the answers it doesn't have in its training data
34+
- E.g. latest news, current events, weather forecasts, etc.
35+
3436
- [x] Web browser UI (made with [Streamlit](https://pyrobbot.streamlit.app))
37+
- Voice chat with continuous voice input and output
38+
- Plus, a familiar interface for those who prefer a traditional chatbot experience
3539
- Add/remove conversations dynamically
3640
- Automatic/editable conversation summary title
37-
- Input via text or voice
38-
- [x] Terminal UI
41+
- Autosave & retrieve chat history
42+
- Resume even the text & voice conversations started outside the web interface
43+
44+
- [x] Chat via terminal
3945
- For a more "Wake up, Neo" experience
40-
- [x] Internet access: The assistent will **search the web** and to find the answers it doesn't have in its training data
41-
- E.g. current events, weather forecasts, etc.
46+
4247
- [x] Fully configurable
43-
- Support for multiple GPT LLMs
48+
- Large number of supported languages (*e.g.*, `rob --lang pt-br`)
49+
- Support for multiple LLMs through the OpenAI API
50+
- Choose your preferred Text-to-Speech (TTS) and Speech-To-Text (STT) engines (google/openai)
4451
- Control over the parameters passed to the OpenAI API, with (hopefully) sensible defaults
4552
- Ability to pass base directives to the LLM
4653
- E.g., to make it adopt a persona, but you decide which directived to pass
4754
- Dynamically modifiable AI parameters in each chat separately
4855
- No need to restart the chat
49-
- [x] Autosave & retrieve chat history
50-
- In the browser UI, you can even read the transcripts of your voice conversations with the AI
56+
5157
- [x] Chat context handling using [embeddings](https://platform.openai.com/docs/guides/embeddings)
5258
- [x] Estimated API token usage and associated costs
5359
- [x] OpenAI API key is **never** stored on disk
@@ -57,7 +63,7 @@ PyRobBot is a python package that uses OpenAI's [GPT large language models (LLMs
5763
## System Requirements
5864
- Python >= 3.9
5965
- A valid [OpenAI API key](https://platform.openai.com/account/api-keys)
60-
- Set in the Web UI or through the environment variable `OPENAI_API_KEY`
66+
- Set it in the Web UI or through the environment variable `OPENAI_API_KEY`
6167
- To enable voice chat, you also need:
6268
- [PortAudio](https://www.portaudio.com/docs/v19-doxydocs/index.html)
6369
- Install on Ubuntu with `sudo apt-get --assume-yes install portaudio19-dev python-all-dev`
@@ -68,16 +74,32 @@ PyRobBot is a python package that uses OpenAI's [GPT large language models (LLMs
6874

6975
## Installation
7076
This, naturally, assumes your system fulfills all [requirements](#system-requirements).
71-
### Using pip
77+
78+
### Regular Installation
79+
The recommended way for most users.
80+
81+
#### Using pip
7282
```shell
7383
pip install pyrobbot
7484
```
75-
76-
### From source
85+
#### From the GitHub repository
7786
```shell
7887
pip install git+https://github.com/paulovcmedeiros/pyRobBot.git
7988
```
8089

90+
### Developer-Mode Installation
91+
The recommended way for those who want to contribute to the project. We use [poetry](https://python-poetry.org) with the [poethepoet](https://poethepoet.natn.io/index.html) plugin. To get everything set up, run:
92+
```shell
93+
# Clean eventual previous install
94+
curl -sSL https://install.python-poetry.org | python3 - --uninstall
95+
rm -rf ${HOME}/.cache/pypoetry/ ${HOME}/.local/bin/poetry ${HOME}/.local/share/pypoetry
96+
# Download and install poetry
97+
curl -sSL https://install.python-poetry.org | python3 -
98+
# Install needed poetry plugin(s)
99+
poetry self add 'poethepoet[poetry_plugin]'
100+
```
101+
102+
81103
## Basic Usage
82104
Upon succesfull installation, you should be able to run
83105
```shell
@@ -92,16 +114,16 @@ and general `rob` options. For info about specific subcommands and the
92114
options that apply to them only, **please run `rob SUBCOMMAND -h`** (note
93115
that the `-h` goes after the subcommand in this case).
94116

95-
### Chatting by Voice (default)
117+
### Using the Web UI (defult, supports voice & text chat)
96118
```shell
97119
rob
98120
```
121+
See also our [demo Streamlit app](https://pyrobbot.streamlit.app)!
99122

100-
### Using the Web UI
123+
### Chatting Only by Voice
101124
```shell
102-
rob ui
125+
rob voice
103126
```
104-
See also our [demo Streamlit app](https://pyrobbot.streamlit.app)!
105127

106128
### Running on the Terminal
107129
```shell

pyproject.toml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tool.poetry]
2-
authors = ["Paulo V C Medeiros <paulo.medeiros@smhi.se>"]
2+
authors = ["Paulo V C Medeiros <impaulov@gmail.com>"]
33
description = "Chat with GPT LLMs over voice, UI & terminal. All with access to the internet. Powered by OpenAI."
44
license = "MIT"
55
name = "pyrobbot"
66
readme = "README.md"
7-
version = "0.6.4"
7+
version = "0.7.0"
88

99
[build-system]
1010
build-backend = "poetry.core.masonry.api"
@@ -31,19 +31,21 @@
3131
streamlit = "^1.31.1"
3232
tiktoken = "^0.6.0"
3333
# Text to speech
34+
audio-recorder-streamlit = "^0.0.8"
3435
beautifulsoup4 = "^4.12.3"
3536
chime = "^0.7.0"
36-
duckduckgo-search = "^4.5.0"
37+
duckduckgo-search = {git = "https://github.com/deedy5/duckduckgo_search"}
3738
gtts = "^2.5.1"
3839
httpx = "^0.26.0"
3940
ipinfo = "^5.0.1"
4041
pydub = "^0.25.1"
4142
pygame = "^2.5.2"
42-
setuptools = "^68.2.2" # Needed by webrtcvad-wheels
43+
setuptools = "^68.2.2" # Needed by webrtcvad-wheels
4344
sounddevice = "^0.4.6"
4445
soundfile = "^0.12.1"
4546
speechrecognition = "^3.10.0"
46-
streamlit-audiorecorder = "^0.0.4"
47+
streamlit-mic-recorder = "^0.0.4"
48+
streamlit-webrtc = "^0.47.1"
4749
tzlocal = "^5.2"
4850
unidecode = "^1.3.7"
4951
webrtcvad-wheels = "^2.0.11.post1"

pyrobbot/__init__.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python3
22
"""Unnoficial OpenAI API UI and CLI tool."""
3-
import contextlib
43
import os
54
import sys
65
import tempfile
@@ -47,7 +46,11 @@ class GeneralDefinitions:
4746

4847
# Location info
4948
IPINFO = defaultdict(lambda: "unknown")
50-
with contextlib.suppress(
51-
requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError
52-
):
49+
try:
5350
IPINFO = ipinfo.getHandler().getDetails().all
51+
except (
52+
requests.exceptions.ReadTimeout,
53+
requests.exceptions.ConnectionError,
54+
ipinfo.exceptions.RequestQuotaExceededError,
55+
) as error:
56+
logger.warning("Cannot get current location info. {}", error)

pyrobbot/app/.streamlit/config.toml

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
[server]
1010
runOnSave = true
1111

12-
[client]
13-
showErrorDetails = true
14-
1512
[theme]
1613
base = "light"
1714
# Colors

0 commit comments

Comments
 (0)