Skip to content

Saarthi is a Flask-based voice assistant and chatbot. It converts speech to text, processes user input with OpenAI's ChatGPT API, and generates responses. With Twilio integration, users can call and interact with Saarthi. Customize the conversation flow and contribute to this open-source project. Let's chat with Saarthi!

License

Notifications You must be signed in to change notification settings

RoyalMamba/MeraSaarthi

Repository files navigation

Saarthi - Voice Assistant Application

Saarthi is a Flask application that acts as a voice assistant and chatbot. Users can call a designated IVR (Interactive Voice Response) number and interact with Saarthi by speaking. The application converts the user's speech to text using transcription, processes the text input using OpenAI's ChatGPT API, generates a response, and converts the response back to speech using Twilio. The conversation continues until the user hangs up the call.

Features

  • Call an IVR number and interact with Saarthi using speech input
  • Convert user's speech to text using transcription
  • Process user's text input using OpenAI's ChatGPT API
  • Generate a response based on the user's input
  • Convert the response to speech using Twilio
  • Continue the conversation until the user hangs up the call

Prerequisites

Before running the application, ensure you have the following:

  • Python 3.x installed
  • Twilio account and phone number with voice capabilities
  • OpenAI API key
  • Flask and other required dependencies installed (check requirements.txt)

Installation

  1. Clone the repository: git clone https://github.com/RoyalMamba/MeraSaarthi.git

  2. Change into the project directory: cd MeraSaarthi

  3. Install the required dependencies: pip install -r requirements.txt

  4. Set up the environment variables:

  • ACCOUNT_SID: Your Twilio account SID
  • AUTH_TOKEN: Your Twilio authentication token
  • OPENAI_API: Your OpenAI API key
  1. Start the Flask application: python main.py

Usage

  1. Ensure the Flask application is running.

  2. Configure your Twilio phone number's voice URL to point to the deployed URL or ngrok URL followed by /call. For example: https://your-app-url.com/call
    Note: It is recommended to run the code in an Online Integrated Development Environment such as Replit because Twilio works on webhooks and running it on localhost won't work until we use ngrok to create a tunnel

  3. Call the Twilio phone number and interact with Saarthi by speaking. Calling won't be available if the user does not have a preminum account hence the can call it via endpoint to initiate a call from the server.

  4. Saarthi will convert your speech to text using transcription, process it using the ChatGPT API, generate a response, and convert it back to speech using Twilio.

  5. Continue the conversation with Saarthi until you hang up the call.

Customization

  • You can customize the welcome message, voice prompts, and conversation flow by modifying the respective TwiML responses in the main.py file.

  • The behavior of the ChatGPT API can be modified to fine-tune the responses generated by Saarthi. Refer to the OpenAI documentation for more details on customizing the chat model.

Contributing

Contributions to Saarthi are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

References

For more details about the research and development of Saarthi, refer to the RESEARCH file.

About

Saarthi is a Flask-based voice assistant and chatbot. It converts speech to text, processes user input with OpenAI's ChatGPT API, and generates responses. With Twilio integration, users can call and interact with Saarthi. Customize the conversation flow and contribute to this open-source project. Let's chat with Saarthi!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published