DocAPI is a Python package that automatically generates API documentation using LLM.
Project description
[ English | 中文 ]
DocAPI is a Python package that automatically generates API documentation using large models. It scans the API route structure, generates or updates the documentation, and provides code call examples.
Installation
pip install docapi
or
pip install -U docapi -i https://pypi.org/simple
GitHub source code installation
pip install git+https://github.com/Shulin-Zhang/docapi
Usage
Method 1 (Recommended)
Automatically scan the routing structure. This is only valid for flask projects and must be used in the environment of api projects.
export OPENAI_API_KEY=your_key
# Generate API documentation
docapi generate server.py
# Update API documentation
docapi update server.py
# Start the web service
docapi serve
Method 2
Generate the configuration file
docapi init
Edit the config.yaml file
# API file list
api_files:
- 'flask_server.py'
- 'flask_api.py'
# OpenAI
openai_api_key: xxx
openai_base_url: 'http://ip:port/v1'
openai_model: 'qwen-plus'
# Azure OpenAI
azure_api_key: null
azure_endpoint: null
azure_api_version: null
azure_model: null
# Generate API documentation
docapi generate --doc_dir ./docs --lang zh --config config.yaml
# Update API documentation
docapi update --doc_dir ./docs --lang zh --config config.yaml
# Start the web service
docapi serve ./docs -h 127.0.0.1 -p 9000
Supported Models
-
OpenAI
-
AzureOpenAI
-
Tongyi Qianwen
Supported API Frameworks
- Flask
Automatic scanning is only valid for the Flask framework and is recommended for use on Flask services.
API Web Page
TODO
-
Supports large models such as Wenxin Yiyan and Zhipu AI.
-
Supports automatic scanning of frameworks such as fastapi and Django.
-
Supports online web page display of documents. -
Supports custom document templates.
-
Multithreading accelerates requests.
-
Import to postman.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file docapi-0.0.9.tar.gz
.
File metadata
- Download URL: docapi-0.0.9.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4de3c49ccec0d39852adb6a159be3b01d9e94ba10b185da3efef8e4ebf8bca6 |
|
MD5 | 03f322d795042b574121462a6c34c473 |
|
BLAKE2b-256 | 22db5fbfa4321be8a72ecba32997aad930203efe637b41f7430d6b818c880ecb |
File details
Details for the file docapi-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: docapi-0.0.9-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce9502c262b9a22f949268588a207f6338d7ff9aed2099974724b5c216558f8e |
|
MD5 | 07f685f779e09e22780fd39db81b37c2 |
|
BLAKE2b-256 | 00278ee1fce15650d2b9fac0845554a31d717125d0ca1a86eb9b367902421a03 |