This is the documentation for the ChatGPT Flask API, which provides endpoints for creating, updating, fetching, and deleting prompts to interact with the ChatGPT language model.
-
Create a virtual environment and activate it.
python -m venv venv
source venv/bin/activate
-
Install the dependencies.
pip install -r requirements.txt
-
Run the app.
python main.py
This endpoint allows you to create a new prompt and store it in prompt configuration. The prompt should be provided in the request body as JSON data under the key prompt.
Input :
POST /create
Content-Type: application/json
{
"prompt": "Your prompt goes here."
}
This endpoint retrieves the response for a given prompt based on its ID from the Openai language model.
Input :
GET /fetch/your-prompt-id
This endpoint allows you to update an existing prompt and get a new response from the language model. You need to provide the prompt ID and the updated prompt in the request body as JSON data.
Input :
PUT /update
Content-Type: application/json
{
"prompt_id": "your-prompt-id",
"new_prompt": "Your updated prompt goes here."
}
This endpoint allows you to delete a prompt and its associated response from the ChatGPT language model.
Input :
DELETE /remove/your-prompt-id
GPT API Task.postman_collection.json