DocAPI is a Python package that automatically generates API documentation using LLM.
Project description
[ English | 中文 ]
DocAPI is a Python package that uses LLM to automatically generate API documentation.
Features
-
The Flask framework supports automatic scanning of the routing structure of API services;
-
Supports Tongyi Qianwen, OpenAI, Azure OpenAI, open source models, etc;
-
Supports automatic document generation and partial document update;
-
Support Chinese and English documents;
-
Supports web page deployment to display API documentation.
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
or
export OPENAI_API_KEY=your_key
export OPENAI_API_BASE=api_base_url
export OPENAI_API_MODEL=model_name
# 生成文档
docapi generate server.py
# 更新文档
docapi update server.py
# 启动web服务
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
Release history Release notifications | RSS feed
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.11.tar.gz
.
File metadata
- Download URL: docapi-0.0.11.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc3138fdb4e518e729ad760c180c11bba5becfe7c3638256295b3b4c176a1016 |
|
MD5 | d74c0eda07fd6089d512c6ac0488fa5c |
|
BLAKE2b-256 | 28bc37e09c3041766c524b388f4b46b68024e249d04cfca52677058453c0f4c0 |
File details
Details for the file docapi-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: docapi-0.0.11-py3-none-any.whl
- Upload date:
- Size: 16.4 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 | 00e11bf7867d12ccbce0e6ddb137a6f7abce6c4692dbde1e23ad096e4c38a682 |
|
MD5 | ca49b06486e01a98bf1e5e025ef728b4 |
|
BLAKE2b-256 | 2139a8857150bfade66834ac1573c7d652cee0f344a61be4b11934b38aa896c4 |