mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-05 14:23:23 +08:00
关于providers的配置说明
This commit is contained in:
parent
e10c0937d8
commit
b375469224
@ -54,9 +54,126 @@ model_providers包含了不同平台提供的 全局配置`provider_credential`,
|
|||||||
不同平台所加载的配置有所不同,关于如何配置这个文件
|
不同平台所加载的配置有所不同,关于如何配置这个文件
|
||||||
|
|
||||||
请查看包`model_providers.core.model_runtime.model_providers`下方的平台 `yaml`文件
|
请查看包`model_providers.core.model_runtime.model_providers`下方的平台 `yaml`文件
|
||||||
例如`zhipuai.yaml`,这里给出了`provider_credential_schema`,其中包含了一个变量`api_key`
|
关于`schemas`信息详细描述设计,请查看 [README_CN.md](model_providers/core/model_runtime/README_CN.md)
|
||||||
|
|
||||||
要加载智谱平台,操作如下
|
|
||||||
|
#### 相关平台配置说明
|
||||||
|
|
||||||
|
|
||||||
|
#### 要加载xinference平台,操作如下
|
||||||
|
|
||||||
|
- 查看`schemas`信息
|
||||||
|
|
||||||
|
在[xinference.yaml](model_providers/core/model_runtime/model_providers/xinference/xinference.yaml)包含了如下信息,
|
||||||
|
`supported_model_types`描述支持了`llm`、`text-embedding`、`rerank` 模型类型
|
||||||
|
`configurate_methods`描述包含变量 `customizable-model`表示这个是一个可以自定义模型的平台
|
||||||
|
`model_credential_schema`描述包含了自定义模型需要的凭据信息
|
||||||
|
|
||||||
|
- 安装sdk
|
||||||
|
```shell
|
||||||
|
$ pip install xinference-client
|
||||||
|
```
|
||||||
|
|
||||||
|
- 编辑`model_providers.yaml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
|
||||||
|
xinference:
|
||||||
|
model_credential:
|
||||||
|
- model: 'chatglm3-6b'
|
||||||
|
model_type: 'llm'
|
||||||
|
model_credentials:
|
||||||
|
server_url: 'http://127.0.0.1:9997/'
|
||||||
|
model_uid: 'chatglm3-6b'
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 要加载ollama平台,操作如下
|
||||||
|
|
||||||
|
- 查看`schemas`信息
|
||||||
|
|
||||||
|
在[ollama.yaml](model_providers/core/model_runtime/model_providers/ollama/ollama.yaml)包含了如下信息,
|
||||||
|
`supported_model_types`描述支持了`llm`和`text-embedding`两种模型类型
|
||||||
|
|
||||||
|
`configurate_methods`描述包含变量
|
||||||
|
- `customizable-model`表示这个是一个可以自定义模型的平台
|
||||||
|
|
||||||
|
`model_credential_schema`描述包含了自定义模型需要的凭据信息
|
||||||
|
- 安装sdk
|
||||||
|
```shell
|
||||||
|
$ pip install openai
|
||||||
|
```
|
||||||
|
|
||||||
|
- 编辑`model_providers.yaml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
|
||||||
|
ollama:
|
||||||
|
model_credential:
|
||||||
|
- model: 'llama3'
|
||||||
|
model_type: 'llm'
|
||||||
|
model_credentials:
|
||||||
|
base_url: 'http://172.21.80.1:11434/v1'
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 要加载openai平台,操作如下
|
||||||
|
|
||||||
|
- 查看`schemas`信息
|
||||||
|
|
||||||
|
在[openai.yaml](model_providers/core/model_runtime/model_providers/openai/openai.yaml)包含了如下信息,
|
||||||
|
`supported_model_types`描述支持了`llm`和`text-embedding`两种模型类型
|
||||||
|
|
||||||
|
`configurate_methods`描述包含变量
|
||||||
|
- `predefined-model`表示这个是一个使用预定义模型的平台
|
||||||
|
- `customizable-model`表示这个是一个可以自定义模型的平台
|
||||||
|
|
||||||
|
`model_credential_schema`描述包含了自定义模型需要的凭据信息
|
||||||
|
`provider_credential_schema`描述包含平台的凭据信息
|
||||||
|
- 安装sdk
|
||||||
|
```shell
|
||||||
|
$ pip install openai
|
||||||
|
```
|
||||||
|
|
||||||
|
- 编辑`model_providers.yaml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
openai:
|
||||||
|
|
||||||
|
model_credential:
|
||||||
|
- model: 'gpt-3.5-turbo'
|
||||||
|
model_type: 'llm'
|
||||||
|
model_credentials:
|
||||||
|
openai_api_key: 'sk-'
|
||||||
|
openai_organization: ''
|
||||||
|
openai_api_base: ''
|
||||||
|
- model: 'gpt-4'
|
||||||
|
model_type: 'llm'
|
||||||
|
model_credentials:
|
||||||
|
openai_api_key: 'sk-'
|
||||||
|
openai_organization: ''
|
||||||
|
openai_api_base: ''
|
||||||
|
|
||||||
|
provider_credential:
|
||||||
|
openai_api_key: 'sk-'
|
||||||
|
openai_organization: ''
|
||||||
|
openai_api_base: ''
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 要加载智谱平台,操作如下
|
||||||
|
|
||||||
|
- 查看`schemas`信息
|
||||||
|
|
||||||
|
在[zhipuai.yaml](model_providers/core/model_runtime/model_providers/zhipuai/zhipuai.yaml)包含了如下信息,
|
||||||
|
`supported_model_types`描述支持了`llm`和`text-embedding`两种模型类型
|
||||||
|
`configurate_methods`描述包含变量 `predefined-model`表示这个是一个使用预定义模型的平台
|
||||||
|
`provider_credential_schema`描述包含平台的凭据信息
|
||||||
|
|
||||||
- 安装sdk
|
- 安装sdk
|
||||||
```shell
|
```shell
|
||||||
@ -73,8 +190,28 @@ zhipuai:
|
|||||||
api_key: 'd4fa0690b6dfa205204cae2e12aa6fb6.2'
|
api_key: 'd4fa0690b6dfa205204cae2e12aa6fb6.2'
|
||||||
```
|
```
|
||||||
|
|
||||||
- `model-providers`可以运行pytest 测试
|
|
||||||
```shell
|
|
||||||
poetry run pytest tests/server_unit_test/test_init_server.py
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 要加载deepseek平台,操作如下
|
||||||
|
|
||||||
|
- 查看`schemas`信息
|
||||||
|
|
||||||
|
在[deepseek.yaml](model_providers/core/model_runtime/model_providers/deepseek/deepseek.yaml)包含了如下信息,
|
||||||
|
`supported_model_types`描述支持了`llm`和`text-embedding`两种模型类型
|
||||||
|
`configurate_methods`描述包含变量 `predefined-model`表示这个是一个使用预定义模型的平台
|
||||||
|
`provider_credential_schema`描述包含平台的凭据信息
|
||||||
|
|
||||||
|
- 安装sdk
|
||||||
|
```shell
|
||||||
|
$ pip install zhipuai
|
||||||
|
```
|
||||||
|
|
||||||
|
- 编辑`model_providers.yaml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
zhipuai:
|
||||||
|
|
||||||
|
provider_credential:
|
||||||
|
api_key: 'd4fa0690b6dfa205204cae2e12aa6fb6.2'
|
||||||
```
|
```
|
||||||
@ -15,6 +15,7 @@ help:
|
|||||||
supported_model_types:
|
supported_model_types:
|
||||||
- llm
|
- llm
|
||||||
configurate_methods:
|
configurate_methods:
|
||||||
|
- predefined-model
|
||||||
- customizable-model
|
- customizable-model
|
||||||
model_credential_schema:
|
model_credential_schema:
|
||||||
model:
|
model:
|
||||||
@ -42,3 +43,22 @@ model_credential_schema:
|
|||||||
placeholder:
|
placeholder:
|
||||||
zh_Hans: 在此输入您的 API Base
|
zh_Hans: 在此输入您的 API Base
|
||||||
en_US: Enter your API Base
|
en_US: Enter your API Base
|
||||||
|
provider_credential_schema:
|
||||||
|
credential_form_schemas:
|
||||||
|
- variable: api_key
|
||||||
|
label:
|
||||||
|
en_US: API Key
|
||||||
|
type: secret-input
|
||||||
|
required: true
|
||||||
|
placeholder:
|
||||||
|
zh_Hans: 在此输入您的 API Key
|
||||||
|
en_US: Enter your API Key
|
||||||
|
- variable: base_url
|
||||||
|
label:
|
||||||
|
zh_Hans: API Base
|
||||||
|
en_US: API Base
|
||||||
|
type: text-input
|
||||||
|
required: false
|
||||||
|
placeholder:
|
||||||
|
zh_Hans: 在此输入您的 API Base
|
||||||
|
en_US: Enter your API Base
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user