This Python project provides an interactive AI assistant that listens to your voice commands, processes your questions using OpenAI's ChatGPT, and responds back using Google Text-to-Speech (gTTs). You can customize the assistant's name, termination phrase, and behavior to suit your needs.
-
Install Dependencies:
-
Obtain API Keys:
- OpenAI: You'll need an API key from OpenAI to use ChatGPT. Visit OpenAI API to get your key.
- Google Cloud: You'll need to set up Google Cloud credentials for the Text-to-Speech API. Follow the instructions here to set it up.
- Set Up Configuration:
- In the
config.py
file, input your OpenAI API key and Google Cloud credentials.
- Customize Settings:
- In the
assistant.py
file, you can customize the assistant's name and termination phrase.
-
Run the Assistant:
-
Interaction:
- The assistant will listen for your voice command after calling its name (customizable).
- Ask the assistant a question, and it will use the ChatGPT API to generate a response.
- The response will be converted to audio using gTTs and read aloud.
- Termination:
- To terminate the assistant, simply say the termination phrase (customizable).
Here's a simple example of the interaction:
- You: "Hey, AI Assistant"
- Assistant: "How can I assist you?"
- You: "What's the weather like today?"
- Assistant: "The weather today is..." (Response generated by ChatGPT)
- Assistant (audio): [Reads out the response]
- You: "Thanks, that's all for now."
- Assistant: "You're welcome!"
- [Assistant terminates]
- Make sure to handle your API keys and sensitive information securely. Do not hardcode them in your code.
- You may need to adjust the code to handle various voice recognition and audio playback configurations based on your environment.
This project is licensed under the MIT License.