mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 12:56:02 +00:00
feat: add new api requester (#1596)
This commit is contained in:
committed by
GitHub
parent
f1ac9c77e6
commit
4a8f5516f6
BIN
pkg/provider/modelmgr/requesters/newapi.png
Normal file
BIN
pkg/provider/modelmgr/requesters/newapi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
17
pkg/provider/modelmgr/requesters/newapichatcmpl.py
Normal file
17
pkg/provider/modelmgr/requesters/newapichatcmpl.py
Normal file
@@ -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,
|
||||
}
|
||||
31
pkg/provider/modelmgr/requesters/newapichatcmpl.yaml
Normal file
31
pkg/provider/modelmgr/requesters/newapichatcmpl.yaml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user