This is a open-source assistant that uses LLMs to power it's decisions through prompts and json responses.
The idea is to make an assistant much like Alexa or Google Assistant, but with a modular architecture so that any developer can improve upon the current design.
This base system comes with some examples for commands that you can implement: [lights, tv_control, ask_gpt]
Browse these folders and files to get a better understanding of how to implement your own commands.
- Clone this repository into your local computer
- Create and activate a python environment
- Rename .env.example to .env
- Fill out
OPENAI_API_KEYwith your OpenAI API key - Install dependencies
pip install -r requirements.txt
- Run
python main.py
Currently we have switched to use TTS from OpenAi as well. There's also an implemented googleTTS module that you can switch if you want to experiment with.
Since there's a generous free limit for google TTS we decided to use this solution as the main one. Of course, due to the modular nature of this implementation you can always substitute for a different TTS of your choice. Instructions on how to setup Google TTS:
- Follow the first part of this guide: https://cloud.google.com/text-to-speech/docs/before-you-begin?hl=pt-br
- Save the json file in your folder.
- Edit the
.envvariableGOOGLE_APPLICATION_CREDENTIALSto point to your json file.
- Input: Currently there are two options for command inputing. Text or Audio.
- Output: Audio or Text
- Running in text mode:
python main.py --input text
To create a new command on cli type python new_command and fill out the name for your new command (must be in snake_case format).
Three files are included in your newly created command folder:
response.py- Pydantic validator file. It validates expected response from the model and also the examplesexamples.json- Examples of the response from the user input. You can add any field you like, but I suggest you keep user_input. These examples are sent with the prompt to the model.<you-cmd-name.py>- This file has anexecutemethod. This is where you should put all the logic for your new command.