AskGPT is a simple web application that uses the OpenAI API to generate responses to user queries using GPT-4 language model. This application is built using FastAPI for the API and JavaScript ,HTML and CSS for the frontend.
- Python 3.11 or higher
- OpenAI API key
- FastAPI
- JavaScript
- Redis Server
- HTML, CSS
- Chrome Browser
- Install packages as outlined in the requirements.txt file
- Get GitHub Client ID for your OAuth App
- Get GitHub Client Secret for your OAuth App
- Get Secret Session Key for your OAuth App
- Clone the repository
- Install the required packages using
pip install -r requirements.txt
- Set the
OPEN_AI_KEY
environment variable with your OpenAI API key. - Setup Redis server on your machine as outlined here https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/
- Start Redis server with
sudo service redis-server start
- On PyCharm Professional IDE, create a FastAPI configuration and run the application using the app.py script.
- The above configuration needs to have the OpenAI API key as well as the GitHub keys outlined in the requirements section.
- Navigate to
http://localhost:8000/
on your Google Chrome browser to access the application. - Login to GitHub using the
Login with GitHub
button. - Enter your query in the input field and click on the
Submit
button to generate a response. - Click on the Mic button to use the speech-to-text feature and get a code completion from GPT-4.
curl -X POST http://127.0.0.1:8000/ask_gpt4/ -H "Content-Type: application/json" -d "{\"user_input\": \"Create a function that adds 2 numbers\", \"model\": \"gpt-4\"}"
Make sure to set the OPEN_AI_KEY
environment variable before running the application, as this is required for the OpenAI API to function properly.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. This project is not licensed for commercial use.
This project is for demonstration of GPT capabilities and should not be used wholly or partly in any commercial project.