开始使用
当项目安装完成,配置这个model_providers.yaml文件,即可完成平台加载
注意: 在您配置平台之前,请确认平台依赖完整,例如智谱平台,您需要安装智谱sdk
pip install zhipuai
model_providers包含了不同平台提供的 全局配置provider_credential,和模型配置model_credential
不同平台所加载的配置有所不同,关于如何配置这个文件
请查看包model_providers.core.model_runtime.model_providers下方的平台 yaml文件
关于schemas信息详细描述设计,请查看 README_CN.md
相关平台配置说明
要加载xinference平台,操作如下
- 查看
schemas信息
在xinference.yaml包含了如下信息,
supported_model_types描述支持了llm、text-embedding、rerank 模型类型
configurate_methods描述包含变量 customizable-model表示这个是一个可以自定义模型的平台
model_credential_schema描述包含了自定义模型需要的凭据信息
- 安装sdk
$ pip install xinference-client
- 编辑
model_providers.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包含了如下信息,
supported_model_types描述支持了llm和text-embedding两种模型类型configurate_methods描述包含变量customizable-model表示这个是一个可以自定义模型的平台
model_credential_schema描述包含了自定义模型需要的凭据信息 -
安装sdk
$ pip install openai
- 编辑
model_providers.yaml
ollama:
model_credential:
- model: 'llama3'
model_type: 'llm'
model_credentials:
base_url: 'http://172.21.192.1:11434/v1'
要加载openai平台,操作如下
-
查看
schemas信息在openai.yaml包含了如下信息,
supported_model_types描述支持了llm和text-embedding两种模型类型configurate_methods描述包含变量predefined-model表示这个是一个使用预定义模型的平台customizable-model表示这个是一个可以自定义模型的平台
model_credential_schema描述包含了自定义模型需要的凭据信息provider_credential_schema描述包含平台的凭据信息 -
安装sdk
$ pip install openai
- 编辑
model_providers.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包含了如下信息,
supported_model_types描述支持了llm和text-embedding两种模型类型configurate_methods描述包含变量predefined-model表示这个是一个使用预定义模型的平台provider_credential_schema描述包含平台的凭据信息 -
安装sdk
$ pip install zhipuai
- 编辑
model_providers.yaml
zhipuai:
provider_credential:
api_key: 'd4fa0690b6dfa205204cae2e12aa6fb6.2'
要加载deepseek平台,操作如下
-
查看
schemas信息在deepseek.yaml包含了如下信息,
supported_model_types描述支持了llm和text-embedding两种模型类型configurate_methods描述包含变量predefined-model表示这个是一个使用预定义模型的平台provider_credential_schema描述包含平台的凭据信息 -
安装sdk
$ pip install openai
- 编辑
model_providers.yaml
deepseek:
model_credential:
- model: 'deepseek-chat'
model_type: 'llm'
model_credentials:
base_url: 'https://api.deepseek.com'
api_key: 'sk-dcb625fcbc1e497d80b7b9493b51d758'
Metadata
Release files for model-providers 0.3.0.20240612
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| model_providers-0.3.0.20240612.tar.gz | 1.7 MB | Without provenance | Details for model_providers-0.3.0.20240612.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| model_providers-0.3.0.20240612-py3-none-any.whl | Python 3 | none | any | Details for model_providers-0.3.0.20240612-py3-none-any.whl |
Total release size: 3.5 MB
Release files / model_providers-0.3.0.20240612.tar.gz
| Download URL | model_providers-0.3.0.20240612.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a3d317badcfb4e2b6fd593a16a514c5f136b2528762119f5da81f8de4dfa2aa
|
|
BLAKE2b-256 checksum How to use checksums |
f83d53230d26d8a0b27e5c8031875b2de3b108a94ce8b65a061f1cf10dc81970
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1
|
Release files / model_providers-0.3.0.20240612-py3-none-any.whl
| Download URL | model_providers-0.3.0.20240612-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b93a0273f073c98561d6272037ae8808dd0c9c5ae9670f417704b4dba5f595f5
|
|
BLAKE2b-256 checksum How to use checksums |
f0bf7fe031c5032482e132cefc622a4bef3711e2a16e11c714c38efd8626230e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1
|
Security for model-providers 0.3.0.20240612
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.