mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-11 21:30:59 +00:00
Merge pull request #1148 from RockChinQ/feat/requester-manifests
feat: add manifests for all requesters
This commit is contained in:
@@ -187,6 +187,9 @@ class ComponentDiscoveryEngine:
|
|||||||
if name == 'ComponentTemplate':
|
if name == 'ComponentTemplate':
|
||||||
continue
|
continue
|
||||||
components[name] = self.load_blueprint_comp_group(component, owner)
|
components[name] = self.load_blueprint_comp_group(component, owner)
|
||||||
|
|
||||||
|
self.ap.logger.debug(f'Components: {components}')
|
||||||
|
|
||||||
return blueprint_manifest, components
|
return blueprint_manifest, components
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import aiohttp
|
|||||||
|
|
||||||
from . import entities, requester
|
from . import entities, requester
|
||||||
from ...core import app
|
from ...core import app
|
||||||
|
from ...discover import engine
|
||||||
from . import token
|
from . import token
|
||||||
from .requesters import bailianchatcmpl, chatcmpl, anthropicmsgs, moonshotchatcmpl, deepseekchatcmpl, ollamachat, giteeaichatcmpl, volcarkchatcmpl, xaichatcmpl, zhipuaichatcmpl, lmstudiochatcmpl, siliconflowchatcmpl, volcarkchatcmpl
|
from .requesters import bailianchatcmpl, chatcmpl, anthropicmsgs, moonshotchatcmpl, deepseekchatcmpl, ollamachat, giteeaichatcmpl, volcarkchatcmpl, xaichatcmpl, zhipuaichatcmpl, lmstudiochatcmpl, siliconflowchatcmpl, volcarkchatcmpl
|
||||||
|
|
||||||
@@ -16,6 +16,8 @@ class ModelManager:
|
|||||||
|
|
||||||
ap: app.Application
|
ap: app.Application
|
||||||
|
|
||||||
|
requester_components: list[engine.Component]
|
||||||
|
|
||||||
model_list: list[entities.LLMModelInfo]
|
model_list: list[entities.LLMModelInfo]
|
||||||
|
|
||||||
requesters: dict[str, requester.LLMAPIRequester]
|
requesters: dict[str, requester.LLMAPIRequester]
|
||||||
@@ -38,14 +40,21 @@ class ModelManager:
|
|||||||
|
|
||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
|
|
||||||
|
self.requester_components = self.ap.discover.get_components_by_kind('LLMAPIRequester')
|
||||||
|
|
||||||
# 初始化token_mgr, requester
|
# 初始化token_mgr, requester
|
||||||
for k, v in self.ap.provider_cfg.data['keys'].items():
|
for k, v in self.ap.provider_cfg.data['keys'].items():
|
||||||
self.token_mgrs[k] = token.TokenManager(k, v)
|
self.token_mgrs[k] = token.TokenManager(k, v)
|
||||||
|
|
||||||
for api_cls in requester.preregistered_requesters:
|
# for api_cls in requester.preregistered_requesters:
|
||||||
|
# api_inst = api_cls(self.ap)
|
||||||
|
# await api_inst.initialize()
|
||||||
|
# self.requesters[api_inst.name] = api_inst
|
||||||
|
for component in self.requester_components:
|
||||||
|
api_cls = component.get_python_component_class()
|
||||||
api_inst = api_cls(self.ap)
|
api_inst = api_cls(self.ap)
|
||||||
await api_inst.initialize()
|
await api_inst.initialize()
|
||||||
self.requesters[api_inst.name] = api_inst
|
self.requesters[component.metadata.name] = api_inst
|
||||||
|
|
||||||
# 尝试从api获取最新的模型信息
|
# 尝试从api获取最新的模型信息
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -10,18 +10,6 @@ from . import entities as modelmgr_entities
|
|||||||
from ..tools import entities as tools_entities
|
from ..tools import entities as tools_entities
|
||||||
|
|
||||||
|
|
||||||
preregistered_requesters: list[typing.Type[LLMAPIRequester]] = []
|
|
||||||
|
|
||||||
def requester_class(name: str):
|
|
||||||
|
|
||||||
def decorator(cls: typing.Type[LLMAPIRequester]) -> typing.Type[LLMAPIRequester]:
|
|
||||||
cls.name = name
|
|
||||||
preregistered_requesters.append(cls)
|
|
||||||
return cls
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
|
|
||||||
class LLMAPIRequester(metaclass=abc.ABCMeta):
|
class LLMAPIRequester(metaclass=abc.ABCMeta):
|
||||||
"""LLM API请求器
|
"""LLM API请求器
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ from ...tools import entities as tools_entities
|
|||||||
from ....utils import image
|
from ....utils import image
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("anthropic-messages")
|
|
||||||
class AnthropicMessages(requester.LLMAPIRequester):
|
class AnthropicMessages(requester.LLMAPIRequester):
|
||||||
"""Anthropic Messages API 请求器"""
|
"""Anthropic Messages API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: anthropic-messages
|
||||||
|
label:
|
||||||
|
en_US: Anthropic
|
||||||
|
zh_CN: Anthropic
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://api.anthropic.com/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./anthropicmsgs.py
|
||||||
|
attr: AnthropicMessages
|
||||||
@@ -7,7 +7,6 @@ from .. import requester
|
|||||||
from ....core import app
|
from ....core import app
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("bailian-chat-completions")
|
|
||||||
class BailianChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class BailianChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""阿里云百炼大模型平台 ChatCompletion API 请求器"""
|
"""阿里云百炼大模型平台 ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: bailian-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: Aliyun Bailian
|
||||||
|
zh_CN: 阿里云百炼
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./bailianchatcmpl.py
|
||||||
|
attr: BailianChatCompletions
|
||||||
@@ -20,7 +20,6 @@ from ...tools import entities as tools_entities
|
|||||||
from ....utils import image
|
from ....utils import image
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("openai-chat-completions")
|
|
||||||
class OpenAIChatCompletions(requester.LLMAPIRequester):
|
class OpenAIChatCompletions(requester.LLMAPIRequester):
|
||||||
"""OpenAI ChatCompletion API 请求器"""
|
"""OpenAI ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: openai-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: OpenAI
|
||||||
|
zh_CN: OpenAI
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://api.openai.com/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./chatcmpl.py
|
||||||
|
attr: OpenAIChatCompletions
|
||||||
@@ -7,7 +7,6 @@ from ... import entities as llm_entities
|
|||||||
from ...tools import entities as tools_entities
|
from ...tools import entities as tools_entities
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("deepseek-chat-completions")
|
|
||||||
class DeepseekChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class DeepseekChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""Deepseek ChatCompletion API 请求器"""
|
"""Deepseek ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: deepseek-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: DeepSeek
|
||||||
|
zh_CN: 深度求索
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://api.deepseek.com"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./deepseekchatcmpl.py
|
||||||
|
attr: DeepseekChatCompletions
|
||||||
@@ -14,7 +14,6 @@ from ...tools import entities as tools_entities
|
|||||||
from .. import entities as modelmgr_entities
|
from .. import entities as modelmgr_entities
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("gitee-ai-chat-completions")
|
|
||||||
class GiteeAIChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class GiteeAIChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""Gitee AI ChatCompletions API 请求器"""
|
"""Gitee AI ChatCompletions API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: gitee-ai-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: Gitee AI
|
||||||
|
zh_CN: Gitee AI
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://ai.gitee.com/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./giteeaichatcmpl.py
|
||||||
|
attr: GiteeAIChatCompletions
|
||||||
@@ -7,7 +7,6 @@ from .. import requester
|
|||||||
from ....core import app
|
from ....core import app
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("lmstudio-chat-completions")
|
|
||||||
class LmStudioChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class LmStudioChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""LMStudio ChatCompletion API 请求器"""
|
"""LMStudio ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: lmstudio-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: LM Studio
|
||||||
|
zh_CN: LM Studio
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "http://127.0.0.1:1234/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./lmstudiochatcmpl.py
|
||||||
|
attr: LmStudioChatCompletions
|
||||||
@@ -9,7 +9,6 @@ from ... import entities as llm_entities
|
|||||||
from ...tools import entities as tools_entities
|
from ...tools import entities as tools_entities
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("moonshot-chat-completions")
|
|
||||||
class MoonshotChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class MoonshotChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""Moonshot ChatCompletion API 请求器"""
|
"""Moonshot ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: moonshot-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: Moonshot
|
||||||
|
zh_CN: 月之暗面
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://api.moonshot.com/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./moonshotchatcmpl.py
|
||||||
|
attr: MoonshotChatCompletions
|
||||||
@@ -20,7 +20,6 @@ from ....utils import image
|
|||||||
REQUESTER_NAME: str = "ollama-chat"
|
REQUESTER_NAME: str = "ollama-chat"
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class(REQUESTER_NAME)
|
|
||||||
class OllamaChatCompletions(requester.LLMAPIRequester):
|
class OllamaChatCompletions(requester.LLMAPIRequester):
|
||||||
"""Ollama平台 ChatCompletion API请求器"""
|
"""Ollama平台 ChatCompletion API请求器"""
|
||||||
client: ollama.AsyncClient
|
client: ollama.AsyncClient
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: ollama-chat
|
||||||
|
label:
|
||||||
|
en_US: Ollama
|
||||||
|
zh_CN: Ollama
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "http://127.0.0.1:11434"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./ollamachat.py
|
||||||
|
attr: OllamaChatCompletions
|
||||||
@@ -7,7 +7,6 @@ from .. import requester
|
|||||||
from ....core import app
|
from ....core import app
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("siliconflow-chat-completions")
|
|
||||||
class SiliconFlowChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class SiliconFlowChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""SiliconFlow ChatCompletion API 请求器"""
|
"""SiliconFlow ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: siliconflow-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: SiliconFlow
|
||||||
|
zh_CN: 硅基流动
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://api.siliconflow.cn/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./siliconflowchatcmpl.py
|
||||||
|
attr: SiliconFlowChatCompletions
|
||||||
@@ -7,7 +7,6 @@ from .. import requester
|
|||||||
from ....core import app
|
from ....core import app
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("volcark-chat-completions")
|
|
||||||
class VolcArkChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class VolcArkChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""火山方舟大模型平台 ChatCompletion API 请求器"""
|
"""火山方舟大模型平台 ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: volcark-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: Volc Engine Ark
|
||||||
|
zh_CN: 火山方舟
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://ark.cn-beijing.volces.com/api/v3"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./volcarkchatcmpl.py
|
||||||
|
attr: VolcArkChatCompletions
|
||||||
@@ -7,7 +7,6 @@ from .. import requester
|
|||||||
from ....core import app
|
from ....core import app
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("xai-chat-completions")
|
|
||||||
class XaiChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class XaiChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""xAI ChatCompletion API 请求器"""
|
"""xAI ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: xai-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: xAI
|
||||||
|
zh_CN: xAI
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://api.x.ai/v1"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./xaichatcmpl.py
|
||||||
|
attr: XaiChatCompletions
|
||||||
@@ -7,7 +7,6 @@ from . import chatcmpl
|
|||||||
from .. import requester
|
from .. import requester
|
||||||
|
|
||||||
|
|
||||||
@requester.requester_class("zhipuai-chat-completions")
|
|
||||||
class ZhipuAIChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class ZhipuAIChatCompletions(chatcmpl.OpenAIChatCompletions):
|
||||||
"""智谱AI ChatCompletion API 请求器"""
|
"""智谱AI ChatCompletion API 请求器"""
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: LLMAPIRequester
|
||||||
|
metadata:
|
||||||
|
name: zhipuai-chat-completions
|
||||||
|
label:
|
||||||
|
en_US: ZhipuAI
|
||||||
|
zh_CN: 智谱 AI
|
||||||
|
spec:
|
||||||
|
config:
|
||||||
|
- name: base-url
|
||||||
|
label:
|
||||||
|
en_US: Base URL
|
||||||
|
zh_CN: 基础 URL
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: "https://open.bigmodel.cn/api/paas/v4"
|
||||||
|
- name: args
|
||||||
|
label:
|
||||||
|
en_US: Args
|
||||||
|
zh_CN: 附加参数
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
default: {}
|
||||||
|
- name: timeout
|
||||||
|
label:
|
||||||
|
en_US: Timeout
|
||||||
|
zh_CN: 超时时间
|
||||||
|
type: int
|
||||||
|
required: true
|
||||||
|
default: 120
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./zhipuaichatcmpl.py
|
||||||
|
attr: ZhipuAIChatCompletions
|
||||||
Reference in New Issue
Block a user