A simple Python application that sends a user prompt to OpenAI's ChatGPT, retrieves the model's response, converts it into speech using AWS Polly, and plays the audio response.
- Python 3.6+
- OpenAI API key
- AWS credentials
- requests
- boto3
- pygame
- python-dotenv
-
Install Dependencies
pip install -r requirements.txt
-
Configure API Keys
- Create a
.env
file in the project root. - Add your API keys:
OPENAI_API_KEY=your_openai_api_key AWS_ACCESS_KEY=your_aws_access_key AWS_SECRET_KEY=your_aws_secret_key AWS_REGION=your_aws_region
- Create a
- Run the Script
python main.py
- Interact with the Bot
- Enter your message when prompted.
- Listen to the audio response from ChatGPT.
- Type
exit
orquit
to end the session.
Ensure that you handle your API keys securely and abide by the usage policies of OpenAI and AWS.
MIT License. See LICENSE for more details.