https://github.com/engageintellect/python-gpt
A basic, minimal implementation of chatGPT using Python and FastAPI
https://github.com/engageintellect/python-gpt
chatgpt fastapi openai python
Last synced: about 1 month ago
JSON representation
A basic, minimal implementation of chatGPT using Python and FastAPI
- Host: GitHub
- URL: https://github.com/engageintellect/python-gpt
- Owner: engageintellect
- Created: 2023-10-07T00:46:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T03:47:16.000Z (over 2 years ago)
- Last Synced: 2025-02-06T13:48:43.525Z (over 1 year ago)
- Topics: chatgpt, fastapi, openai, python
- Language: Python
- Homepage:
- Size: 10.9 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# python-gpt
## Getting Started
Clone Repository (or use the template to create your own repository)
```
git clone https://github.com/engageintellect/python-gpt.git
```
### Setup Environment
Create a config file for your OpenAI API key
```
sudo nvim /etc/python-gpt.json
```
It should look something like this:
```
{
"OPENAI_API_KEY": ""
}
```
Now, create a virtual environment and install the requirements
```
cd python-gpt
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
### Run
Start your server
```
uvircorn main:app --reload
```
### Test
Test your api in your terminal with curl
```
curl -X POST -H "Content-Type: application/json" -d '{"message": "Hello, ChatGPT!"}' http://localhost:8000/chat
```