Interactive AI Assistant with gTTs and OpenAI ChatGPT

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.

Getting Started

  1. Install Dependencies:

  2. 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.
  1. Set Up Configuration:
  • In the config.py file, input your OpenAI API key and Google Cloud credentials.
  1. Customize Settings:
  • In the assistant.py file, you can customize the assistant's name and termination phrase.

Usage

  1. Run the Assistant:

  2. 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.
  1. Termination:
  • To terminate the assistant, simply say the termination phrase (customizable).

Example

Here's a simple example of the interaction:

  1. You: "Hey, AI Assistant"
  2. Assistant: "How can I assist you?"
  3. You: "What's the weather like today?"
  4. Assistant: "The weather today is..." (Response generated by ChatGPT)
  5. Assistant (audio): [Reads out the response]
  6. You: "Thanks, that's all for now."
  7. Assistant: "You're welcome!"
  8. [Assistant terminates]

Note

  • 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.

License

This project is licensed under the MIT License.