mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-03 13:13:13 +08:00
xinference 插件示例
This commit is contained in:
parent
056b15b99b
commit
a401779120
@ -20,9 +20,10 @@ openai:
|
||||
|
||||
xinference:
|
||||
model_credential:
|
||||
- model: 'gpt-3.5-turbo'
|
||||
- model: 'chatglm3-6b'
|
||||
model_type: 'llm'
|
||||
credential:
|
||||
openai_api_key: ''
|
||||
openai_organization: ''
|
||||
openai_api_base: ''
|
||||
model_credentials:
|
||||
server_url: 'http://127.0.0.1:9997/'
|
||||
model_uid: 'gpt-3.5-turbo'
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
- chatglm3-6b
|
||||
@ -0,0 +1,43 @@
|
||||
model: chatglm3-6b
|
||||
label:
|
||||
zh_Hans: chatglm3-6b
|
||||
en_US: chatglm3-6b
|
||||
model_type: llm
|
||||
features:
|
||||
- multi-tool-call
|
||||
- agent-thought
|
||||
- stream-tool-call
|
||||
model_properties:
|
||||
mode: chat
|
||||
context_size: 4096
|
||||
parameter_rules:
|
||||
- name: temperature
|
||||
use_template: temperature
|
||||
- name: top_p
|
||||
use_template: top_p
|
||||
- name: presence_penalty
|
||||
use_template: presence_penalty
|
||||
- name: frequency_penalty
|
||||
use_template: frequency_penalty
|
||||
- name: max_tokens
|
||||
use_template: max_tokens
|
||||
default: 512
|
||||
min: 1
|
||||
max: 4096
|
||||
- name: response_format
|
||||
label:
|
||||
zh_Hans: 回复格式
|
||||
en_US: response_format
|
||||
type: string
|
||||
help:
|
||||
zh_Hans: 指定模型必须输出的格式
|
||||
en_US: specifying the format that the model must output
|
||||
required: false
|
||||
options:
|
||||
- text
|
||||
- json_object
|
||||
pricing:
|
||||
input: '0.001'
|
||||
output: '0.002'
|
||||
unit: '0.001'
|
||||
currency: USD
|
||||
@ -212,7 +212,7 @@ class ProviderManager:
|
||||
:return:
|
||||
"""
|
||||
# Get provider credential secret variables
|
||||
provider_credential_secret_variables = self._extract_secret_variables(
|
||||
provider_credential_secret_variables = self._extract_variables(
|
||||
provider_entity.provider_credential_schema.credential_form_schemas
|
||||
if provider_entity.provider_credential_schema
|
||||
else []
|
||||
@ -229,7 +229,7 @@ class ProviderManager:
|
||||
)
|
||||
|
||||
# Get provider model credential secret variables
|
||||
model_credential_secret_variables = self._extract_secret_variables(
|
||||
model_credential_variables = self._extract_variables(
|
||||
provider_entity.model_credential_schema.credential_form_schemas
|
||||
if provider_entity.model_credential_schema
|
||||
else []
|
||||
@ -242,7 +242,7 @@ class ProviderManager:
|
||||
continue
|
||||
|
||||
provider_model_credentials = {}
|
||||
for variable in model_credential_secret_variables:
|
||||
for variable in model_credential_variables:
|
||||
if variable in provider_model_record.get("model_credentials"):
|
||||
try:
|
||||
provider_model_credentials[
|
||||
@ -265,18 +265,17 @@ class ProviderManager:
|
||||
provider=custom_provider_configuration, models=custom_model_configurations
|
||||
)
|
||||
|
||||
def _extract_secret_variables(
|
||||
def _extract_variables(
|
||||
self, credential_form_schemas: list[CredentialFormSchema]
|
||||
) -> list[str]:
|
||||
"""
|
||||
Extract secret input form variables.
|
||||
Extract input form variables.
|
||||
|
||||
:param credential_form_schemas:
|
||||
:return:
|
||||
"""
|
||||
secret_input_form_variables = []
|
||||
input_form_variables = []
|
||||
for credential_form_schema in credential_form_schemas:
|
||||
if credential_form_schema.type == FormType.SECRET_INPUT:
|
||||
secret_input_form_variables.append(credential_form_schema.variable)
|
||||
input_form_variables.append(credential_form_schema.variable)
|
||||
|
||||
return secret_input_form_variables
|
||||
return input_form_variables
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user