Skip to content

Commit 163bf3a

Browse files
author
zhangshulin
committed
更新版本至 1.1.12,优化 LLM 构建逻辑并引入必要的模块
1 parent 75c6a5f commit 163bf3a

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

docapi/llm/llm_builder.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import os
2-
from docapi.llm.openai_llm import OpenAILLM
3-
from docapi.llm.azure_openai_llm import AzureOpenAILLM
4-
from docapi.llm.baidu_llm import BaiduLLM
5-
from docapi.llm.zhipu_llm import ZhipuLLM
62

73

84
def build_llm(model):
@@ -11,6 +7,8 @@ def build_llm(model):
117
model_name = model_name.strip()
128

139
if provider in ['deepseek', 'baichuan', 'doubao', 'moonshot', 'openai', 'xai', 'aliyun', 'open-source']:
10+
from docapi.llm.openai_llm import OpenAILLM
11+
1412
if provider == 'deepseek':
1513
api_key = os.getenv('DEEPSEEK_API_KEY')
1614
base_url = 'https://api.deepseek.com'
@@ -42,17 +40,23 @@ def build_llm(model):
4240
return OpenAILLM(api_key=api_key, base_url=base_url, model=model_name)
4341

4442
elif provider == 'azure-openai':
43+
from docapi.llm.azure_openai_llm import AzureOpenAILLM
44+
4545
api_key = os.getenv('AZURE_OPENAI_API_KEY')
4646
endpoint = os.getenv('AZURE_OPENAI_ENDPOINT')
4747
api_version = os.getenv('OPENAI_API_VERSION')
4848
return AzureOpenAILLM(api_key=api_key, endpoint=endpoint, api_version=api_version, model=model_name)
4949

5050
elif provider == 'baidu':
51+
from docapi.llm.baidu_llm import BaiduLLM
52+
5153
access_key = os.getenv('QIANFAN_ACCESS_KEY')
5254
secret_key = os.getenv('QIANFAN_SECRET_KEY')
5355
return BaiduLLM(access_key=access_key, secret_key=secret_key, model=model_name)
5456

5557
elif provider == 'zhipu':
58+
from docapi.llm.zhipu_llm import ZhipuLLM
59+
5660
api_key = os.getenv('ZHIPUAI_API_KEY')
5761
return ZhipuLLM(api_key=api_key, model=model_name)
5862

docapi/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from docapi.docapi import DocAPI
1010

1111

12-
VERSION = '1.1.11'
12+
VERSION = '1.1.12'
1313

1414

1515
class Main:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "docapi"
3-
version = "1.1.11"
3+
version = "1.1.12"
44
description = "DocAPI is a Python package that automatically generates API documentation using LLMs. It currently supports Flask and Django frameworks."
55
authors = ["zhangshulin <zhangslwork@yeah.net>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)