Skip to main content

Use LLMs to call functions.

Project description

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 and OpenAI's API. You need an openai API account to use it.

Usage: API

You can use it from Python (see example notebook) by

  • initializing an Assistant,
from blablado import Assistant
assistant = Assistant()
  • providing functions/tools and
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
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). 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:

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:

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:

assistant.listen()

Usage: Voice output

To make the voice output work as well, just activate the voice when initializing the assistant:

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 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 along with a detailed description and tag [@haesleinhuepf].

Acknowledgements

Parts of the code reused here were originally written by kevinyamauchi for the bia-bob project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blablado-0.2.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

blablado-0.2.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file blablado-0.2.1.tar.gz.

File metadata

  • Download URL: blablado-0.2.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for blablado-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e275139f8d1fe2ae2e38d8f2ba07fc25cd7801dda401b1230b0017639f6fa180
MD5 8eacca47fb2084cd292ff7c7837b7117
BLAKE2b-256 4a5ede4a832a7a48c12bd4789f9218d3bca416722ca9d301de30de10b9b1268d

See more details on using hashes here.

File details

Details for the file blablado-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: blablado-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for blablado-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e91a6469be10731f868b3370f7f78c89ab702f5c0ef329f376efa0b1d8b39d3
MD5 60b135a982cfaed69eb1976d28686bee
BLAKE2b-256 df21bd6c087ea69e0da73fd89af6958ac6c818d6cdf355964b22cf666ad50136

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page