Skip to main content

开始使用

当项目安装完成,配置这个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描述支持了llmtext-embeddingrerank 模型类型 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描述支持了llmtext-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描述支持了llmtext-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描述支持了llmtext-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描述支持了llmtext-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'

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_providers-0.3.0.20240606.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

model_providers-0.3.0.20240606-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file model_providers-0.3.0.20240606.tar.gz.

File metadata

  • Download URL: model_providers-0.3.0.20240606.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.9.1-arch1-1

File hashes

Hashes for model_providers-0.3.0.20240606.tar.gz
Algorithm Hash digest
SHA256 7b347a24bd3fa9885e7ecbd9e08e3cfd25f4df88eee91cad46568b550962640b
MD5 e6a03a2a53236207097651d05767524d
BLAKE2b-256 1893bfd1b2f8885fd6d8b1592677fd157db0fd761a4b3a588467903a37324e0c

See more details on using hashes here.

File details

Details for the file model_providers-0.3.0.20240606-py3-none-any.whl.

File metadata

File hashes

Hashes for model_providers-0.3.0.20240606-py3-none-any.whl
Algorithm Hash digest
SHA256 0f96b8c2edd0b56323f0450ba86a321d06335cee83d8786b2e2f768d553e8b73
MD5 8f4e13e818c1c4cfdefd64534a0d06c4
BLAKE2b-256 aa3c06f18448908bf077f814ff06c9c23d139b7225fc9a2c4e40c01881ca8e4d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

0.3.0.20240621

2 files

0.3.0.20240619

2 files

0.3.0.20240618

2 files

0.3.0.20240616

2 files

0.3.0.20240612

2 files

0.3.0.20240610

2 files

This release

0.3.0.20240606 This release

2 files

0.3.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page