# blablado
`blablado` is an extensible Assistant, that listens to your voice and can execute custom Python functions you provided.
It can speak as well. It is based on [LangChain](https://python.langchain.com/docs/get_started/introduction.html) and [OpenAI's API](https://openai.com/blog/openai-api). You need an openai API account to use it.
## Usage: API
You can use it from Python ([see example notebook](https://github.com/haesleinhuepf/blablado/blob/main/demo/API_demo.ipynb)) by
* initializing an `Assistant`,
```python
from blablado import Assistant
assistant = Assistant()
```
* providing functions/tools and
```python
from datetime import datetime
@assistant.register_tool
def book_room(room:str, author:str, start:datetime, end:datetime):
"""Book a room for a specific person from start to end time."""
print(f"""
Booking {room} for {author} from {start} to {end}.
""")
```
* prompting for tasks
```python
assistant.do("Hi I'm Robert, please book room A03.21 for me from 3 to 4 pm tomorrow. Thanks")
```
Output:
```
I have successfully booked room A03.21 for Robert from 3 to 4 pm tomorrow.
```
## Usage: Microphone
You can also use it via microphone ([see example notebook](https://github.com/haesleinhuepf/blablado/blob/main/demo/audio_demo.ipynb)). You need to install some more library before this works:
```
pip install SpeechRecognition pydub gTTS PyAudio
```
Therefore, it is recommended to print out the list of available microphones like this:
```python
from blablado import list_microphones
list_microphones()
```
Example output:
```
['Microsoft Sound Mapper - Input',
'Microphone (KLICK&SHOW Audio)',
'AI Noise-cancelling Input (ASUS',
'Headset (MAJOR IV Hands-Free AG',
'Microphone Array (Realtek(R) Au']
```
Then, choose the right microphone after initializing the assistant:
```python
from blablado import Assistant
assistant = Assistant()
assistant.microphone_index = 3
```
You can then call the assistant to listen to your voice and execute the function you want to call:
```python
assistant.listen()
```
## Usage: Voice output
To make the voice output work as well, just activate the voice when initializing the assistant:
```python
from blablado import Assistant
assistant = Assistant(has_voice=True)
```
## Installation
`blablado` is available on pypi and can be installed using `pip`. It is recommended to install it in a virtual environment, e.g. set up with mamba.
```
mamba create --name bla python=3.9
```
```
mamba activate bla
```
```
pip install blablado
```
To make the voice-output work (optional), consider installing [ffmpeg](https://anaconda.org/conda-forge/ffmpeg) using mamba.
```
mamba install ffmpeg
```
## Issues
If you encounter any problems or want to provide feedback or suggestions, please create a thread on [image.sc](https://image.sc) along with a detailed description and tag [@haesleinhuepf].
## Acknowledgements
Parts of the code reused here were originally written by [kevinyamauchi](https://github.com/kevinyamauchi) for the [bia-bob](https://github.com/haesleinhuepf/bia-bob) project.
Raw data
{
"_id": null,
"home_page": "https://github.com/haesleinhuepf/blablado",
"name": "blablado",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Robert Haase",
"author_email": "robert.haase@uni-leipzig.de",
"download_url": "https://files.pythonhosted.org/packages/ba/58/03b475602f8924adc06435f8f3dd9e575869e94e319f1eab48621aaa682a/blablado-0.2.2.tar.gz",
"platform": null,
"description": "# blablado\r\n\r\n`blablado` is an extensible Assistant, that listens to your voice and can execute custom Python functions you provided. \r\nIt can speak as well. It is based on [LangChain](https://python.langchain.com/docs/get_started/introduction.html) and [OpenAI's API](https://openai.com/blog/openai-api). You need an openai API account to use it.\r\n\r\n## Usage: API\r\n\r\nYou can use it from Python ([see example notebook](https://github.com/haesleinhuepf/blablado/blob/main/demo/API_demo.ipynb)) by \r\n\r\n* initializing an `Assistant`, \r\n```python\r\nfrom blablado import Assistant\r\nassistant = Assistant()\r\n```\r\n\r\n* providing functions/tools and\r\n\r\n```python\r\nfrom datetime import datetime\r\n\r\n@assistant.register_tool\r\ndef book_room(room:str, author:str, start:datetime, end:datetime):\r\n \"\"\"Book a room for a specific person from start to end time.\"\"\"\r\n \r\n print(f\"\"\"\r\n Booking {room} for {author} from {start} to {end}.\r\n \"\"\")\r\n```\r\n\r\n\r\n* prompting for tasks\r\n\r\n```python\r\nassistant.do(\"Hi I'm Robert, please book room A03.21 for me from 3 to 4 pm tomorrow. Thanks\")\r\n```\r\n\r\nOutput:\r\n```\r\nI have successfully booked room A03.21 for Robert from 3 to 4 pm tomorrow.\r\n```\r\n\r\n## Usage: Microphone\r\n\r\nYou can also use it via microphone ([see example notebook](https://github.com/haesleinhuepf/blablado/blob/main/demo/audio_demo.ipynb)). You need to install some more library before this works:\r\n\r\n```\r\npip install SpeechRecognition pydub gTTS PyAudio\r\n```\r\n\r\nTherefore, it is recommended to print out the list of available microphones like this:\r\n\r\n```python\r\nfrom blablado import list_microphones\r\nlist_microphones()\r\n```\r\nExample output:\r\n```\r\n['Microsoft Sound Mapper - Input',\r\n 'Microphone (KLICK&SHOW Audio)',\r\n 'AI Noise-cancelling Input (ASUS',\r\n 'Headset (MAJOR IV Hands-Free AG',\r\n 'Microphone Array (Realtek(R) Au']\r\n```\r\n\r\nThen, choose the right microphone after initializing the assistant:\r\n\r\n```python\r\nfrom blablado import Assistant\r\nassistant = Assistant()\r\nassistant.microphone_index = 3\r\n```\r\n\r\nYou can then call the assistant to listen to your voice and execute the function you want to call:\r\n```python\r\nassistant.listen()\r\n```\r\n\r\n## Usage: Voice output\r\n\r\nTo make the voice output work as well, just activate the voice when initializing the assistant:\r\n\r\n```python\r\nfrom blablado import Assistant\r\nassistant = Assistant(has_voice=True)\r\n```\r\n\r\n## Installation\r\n\r\n`blablado` is available on pypi and can be installed using `pip`. It is recommended to install it in a virtual environment, e.g. set up with mamba.\r\n\r\n```\r\nmamba create --name bla python=3.9\r\n```\r\n\r\n```\r\nmamba activate bla\r\n```\r\n\r\n```\r\npip install blablado\r\n```\r\n\r\nTo make the voice-output work (optional), consider installing [ffmpeg](https://anaconda.org/conda-forge/ffmpeg) using mamba.\r\n\r\n```\r\nmamba install ffmpeg\r\n```\r\n\r\n## Issues\r\n\r\nIf you encounter any problems or want to provide feedback or suggestions, please create a thread on [image.sc](https://image.sc) along with a detailed description and tag [@haesleinhuepf].\r\n\r\n## Acknowledgements\r\n\r\nParts of the code reused here were originally written by [kevinyamauchi](https://github.com/kevinyamauchi) for the [bia-bob](https://github.com/haesleinhuepf/bia-bob) project.\r\n\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Use LLMs to call functions.",
"version": "0.2.2",
"project_urls": {
"Bug Tracker": "https://github.com/haesleinhuepf/blablado/issues",
"Documentation": "https://github.com/haesleinhuepf/blablado#README.md",
"Homepage": "https://github.com/haesleinhuepf/blablado",
"Source Code": "https://github.com/haesleinhuepf/blablado",
"User Support": "https://github.com/haesleinhuepf/blablado/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "333808b0bfa523164617aadeb3c2077cbd6ff86430994f8443e8e50d2a3568ac",
"md5": "aa05de4c6016ba528c9648fc61bb7c44",
"sha256": "792663c584dadb2fad34e8c99155c1086d3918373e3abaf3bc8f517d0dbecdd0"
},
"downloads": -1,
"filename": "blablado-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa05de4c6016ba528c9648fc61bb7c44",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8412,
"upload_time": "2024-08-03T13:37:30",
"upload_time_iso_8601": "2024-08-03T13:37:30.542739Z",
"url": "https://files.pythonhosted.org/packages/33/38/08b0bfa523164617aadeb3c2077cbd6ff86430994f8443e8e50d2a3568ac/blablado-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ba5803b475602f8924adc06435f8f3dd9e575869e94e319f1eab48621aaa682a",
"md5": "f1065e5764585ccab7f787edd00a9af9",
"sha256": "063401a51fc3c0e9253736c2c9176c773734f3fcfa65baf1a08048dccce2b1ff"
},
"downloads": -1,
"filename": "blablado-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "f1065e5764585ccab7f787edd00a9af9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9930,
"upload_time": "2024-08-03T13:37:32",
"upload_time_iso_8601": "2024-08-03T13:37:32.085744Z",
"url": "https://files.pythonhosted.org/packages/ba/58/03b475602f8924adc06435f8f3dd9e575869e94e319f1eab48621aaa682a/blablado-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-03 13:37:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "haesleinhuepf",
"github_project": "blablado",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "blablado"
}