Skip to main content

DocAPI is a Python package that automatically generates API documentation using LLM.

Project description

image

Python Version OS Lisence PyPI GitHub pull request

[ 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 a variety of mainstream commercial and open source models at home and abroad;

  • Supports automatic document generation and partial document update;

  • Supports 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

Automatically scan the routing structure. This is only valid for flask projects and must be used in the environment of api projects.

OpenAI:

export OPENAI_API_KEY=api_key

export OPENAI_API_MODEL=gpt-4o-mini

# Generate documents
docapi generate server.py --lang en

# Update documents
docapi update server.py --lang en

# Start web service
docapi serve

Qianwen, open source model:

export OPENAI_API_KEY=api_key

export OPENAI_API_BASE=api_base_url

export OPENAI_API_MODEL=model_name

# Generate documents
docapi generate server.py --lang en

# Update documents
docapi update server.py --lang en

# Start web service
docapi serve

Baidu Qianfan:

export QIANFAN_ACCESS_KEY=access_key

export QIANFAN_SECRET_KEY=secret_key

export QIANFAN_MODEL=ERNIE-3.5-8K

# Generate documents
docapi generate server.py --lang en

# Update documents
docapi update server.py --lang en

# Start web service
docapi serve

ZhipuAI:

export ZHIPUAI_API_KEY=api_key

export ZHIPUAI_MODEL=glm-4-flash

# Generate documents
docapi generate server.py

# Update documents
docapi update server.py

# Start web service
docapi serve

Changelog

  • [2024-11-17] Support Zhipu AI, Baidu Qianfan model, optimize document structure, and add javascript code examples; Remove the execution mode that uses the configuration file.

Supported Models

  • OpenAI

  • AzureOpenAI

  • Tongyi Qianwen

  • Zhipu AI

  • Baidu Qianfan

  • Open source model

Supported API Frameworks

  • Flask

Automatic scanning is only valid for the Flask framework and is recommended for use on Flask services.

API Web Page

image

TODO

  • Supports large models such as Wenxin Yiyan and Zhipu AI.

  • Supports automatic scanning of frameworks such as 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

docapi-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

docapi-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file docapi-0.1.0.tar.gz.

File metadata

  • Download URL: docapi-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for docapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a90ff5fe35720922f814cd4f3bd757a7f5248e74ad4f7f82454b0b61c1e4083
MD5 2b19bbfffa87b058395998a076a58b06
BLAKE2b-256 e21ab317c7529086d0d8c7601ae88f7bbeb0a21038ee4255b29e0c3b4ca9bce5

See more details on using hashes here.

File details

Details for the file docapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: docapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for docapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00a10be8d42596f690008d91f31fbe5f2be2c680e73f1a1ba3ba71cad7ca91d7
MD5 4b5b230d08e531406332eaddc7eb01ed
BLAKE2b-256 6df8c357eedc7d5582df22dab789d5b55ef28ee6b41f1bf930e042d30663cc7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page