Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egeucak/api-doc-gpt
ChatGPT for Openapi
https://github.com/egeucak/api-doc-gpt
chatgpt-api fastapi gpt-35-turbo gpt-4 openai openapi openapi3 python
Last synced: about 1 month ago
JSON representation
ChatGPT for Openapi
- Host: GitHub
- URL: https://github.com/egeucak/api-doc-gpt
- Owner: egeucak
- License: mit
- Created: 2023-03-04T21:34:21.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-27T15:02:29.000Z (almost 2 years ago)
- Last Synced: 2024-08-13T07:07:27.235Z (5 months ago)
- Topics: chatgpt-api, fastapi, gpt-35-turbo, gpt-4, openai, openapi, openapi3, python
- Language: Python
- Homepage:
- Size: 314 KB
- Stars: 45
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - egeucak/api-doc-gpt - ChatGPT for Openapi (Python)
README
# API Doc GPT
This is an AI tool that helps you discover your API documentation. It is based on the [GPT-3.5](https://openai.com/blog/better-language-models/) language model from OpenAI.
You can use this with either directly connecting to a FastApi app or by passing in an `openapi.json` file.## Setup
Install the dependencies
```bash
pip install -r requirements.txt
```## How to use with FastApi
1. Run your backend app
```bash
uvicorn main:app --reload
```2. Run the script
```bash
python api_master.py --openai-key --target --base-url
```## How to use with openapi.json
```bash
python api_master.py --openai-key --openapi-json --base-url
```## Running example
```bash
python api_master.py --openai-key= --openapi-json=./example/openapi.json --base-url="https://petstore3.swagger.io/api/v3"
```Enjoy interacting with your API documentation
![showcase](./showcase.png)# With GPT-4
This also works with GPT-4. You just need to pass parameter `--model-name=gpt-4` while running the script.
## How it works
This works by creating open api documentation from your fastapi app and then using the GPT-3.5 language model to analyze documentation for your API.
```mermaid
sequenceDiagram
User-->>+Processor: Give me a list of items. I only need 5 of them
Processor-->>+AI: PROMPT: Give me a list of items. I only need 5 of them
AI-->>+Processor: CMD: GET /items?filter=5
Processor-->>+AI: CMD_RESP: [{"name": "cucumber"}, {"name": "celery"}...]
AI-->>+Processor: OUT: Items are cucumber, celery...
Processor-->>+User: Items are cucumber, celery...
```This also supports react. More detail can be found at: https://arxiv.org/abs/2210.03629
## Constraints
- Token size