diff --git a/pkg/provider/modelmgr/requesters/newapi.png b/pkg/provider/modelmgr/requesters/newapi.png new file mode 100644 index 00000000..851556f6 Binary files /dev/null and b/pkg/provider/modelmgr/requesters/newapi.png differ diff --git a/pkg/provider/modelmgr/requesters/newapichatcmpl.py b/pkg/provider/modelmgr/requesters/newapichatcmpl.py new file mode 100644 index 00000000..3c2bd3fb --- /dev/null +++ b/pkg/provider/modelmgr/requesters/newapichatcmpl.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +import typing +import openai + +from . import chatcmpl + + +class NewAPIChatCompletions(chatcmpl.OpenAIChatCompletions): + """New API ChatCompletion API 请求器""" + + client: openai.AsyncClient + + default_config: dict[str, typing.Any] = { + 'base_url': 'http://localhost:3000/v1', + 'timeout': 120, + } diff --git a/pkg/provider/modelmgr/requesters/newapichatcmpl.yaml b/pkg/provider/modelmgr/requesters/newapichatcmpl.yaml new file mode 100644 index 00000000..33573df5 --- /dev/null +++ b/pkg/provider/modelmgr/requesters/newapichatcmpl.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: LLMAPIRequester +metadata: + name: new-api-chat-completions + label: + en_US: New API + zh_Hans: New API + icon: newapi.png +spec: + config: + - name: base_url + label: + en_US: Base URL + zh_Hans: 基础 URL + type: string + required: true + default: "http://localhost:3000/v1" + - name: timeout + label: + en_US: Timeout + zh_Hans: 超时时间 + type: integer + required: true + default: 120 + support_type: + - llm + - text-embedding +execution: + python: + path: ./newapichatcmpl.py + attr: NewAPIChatCompletions \ No newline at end of file