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.20240610.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.20240610-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: model_providers-0.3.0.20240610.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1

File hashes

Hashes for model_providers-0.3.0.20240610.tar.gz
Algorithm Hash digest
SHA256 82896023e144a1fe1a9f936936ab1879a75765483335fc8f3b0a1dc650affe6a
MD5 224a2262becb6c0c6828e0c75797773c
BLAKE2b-256 dbc31b6f02fb4590f0eb3b7ec78b5e99cd4aaa20ff71ddbf26270735d770c8ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for model_providers-0.3.0.20240610-py3-none-any.whl
Algorithm Hash digest
SHA256 ef03d1d6061bc9ec8c72b779e1f079bff32414010e175d7062a768c790d9105b
MD5 f74b6fe0e911390bb376967a35d28c96
BLAKE2b-256 888a0939ceb655aaba775ea7377df7669a7be708ccb6e8a2bf1dad918588a5b9

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

This release

0.3.0.20240610 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