/alexa-with-chatgpt

Welcome to Alexa with ChatGPT, a project that combines the capabilities of the popular virtual assistant Alexa and the powerful language model ChatGPT to create a kind and helpful coding companion.

Primary LanguagePythonMIT LicenseMIT

Alexa with ChatGPT

Tutorial: https://youtu.be/07jH7cM36uQ

Welcome to Alexa with ChatGPT, a project that combines the capabilities of the popular virtual assistant Alexa and the powerful language model ChatGPT to create a kind and helpful coding companion. This assistant, inspired by the character Gideon from the TV show "The Flash," will assist you in your coding endeavors and provide a delightful coding experience.

Introduction

Alexa with ChatGPT is a Python-based project that brings together various libraries and APIs to create an interactive coding environment. It utilizes the Google Text-to-Speech (gTTS) library for speech synthesis and the SpeechRecognition library for converting speech to text. The OpenAI GPT-3.5 Turbo model is employed to process and generate responses.

Features

  • A friendly and helpful assistant with a persona inspired by Gideon from "The Flash."
  • Interactive speech-based communication with the assistant.
  • Voice synthesis and recognition using gTTS and SpeechRecognition libraries.
  • Seamless integration with OpenAI's GPT-3.5 Turbo for natural language understanding and generation.
  • Supports a wide range of coding-related queries and general assistance.

Getting Started

To set up and use Alexa with ChatGPT on your machine, follow these steps:

  1. Clone the repository: git clone https://github.com/art3mistical/alexa-with-chatgpt.git
  2. Install the required Python packages: pip install gtts speechrecognition pygame openai
  3. Obtain an API key from OpenAI and replace openai.api_key with your actual API key in the script.
  4. Run the script: python main.py
  5. Enjoy coding with your virtual assistant!

How it Works

  1. The assistant starts with a warm greeting based on the time of day.
  2. The user can communicate with the assistant using voice commands.
  3. The assistant listens to the user's queries through the microphone.
  4. SpeechRecognition converts the speech to text.
  5. The user's query is sent to the OpenAI GPT-3.5 Turbo model for processing.
  6. The model generates a response based on the user's query and previous interactions.
  7. The response is converted to speech using gTTS and played back to the user.
  8. The conversation continues until the user decides to quit.

Example Interaction

User: "Hello, Alexa. Can you help me with a Python function?"

Alexa: "Of course! I'd be happy to help. Please tell me more about the function you need assistance with."

User: "I want to create a function that calculates the factorial of a number."

Alexa: "Great choice! Here's a Python function to calculate the factorial of a given number:"

def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

User: "Thank you, Alexa! That's exactly what I needed."

Contribution Guidelines

Contributions to this project are welcome! If you have any suggestions, bug fixes, or feature requests, feel free to open an issue or submit a pull request. Please ensure to follow the project's code of conduct.

License

This project is licensed under the MIT License. You can find the details in the LICENSE file.


Have fun coding with your virtual assistant! If you encounter any issues or have questions, don't hesitate to reach out. Happy coding! 🚀