An open API service indexing awesome lists of open source software.

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

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
```