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

Uploaded Python 3

File details

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

File metadata

  • Download URL: model_providers-0.3.0.20240616.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.20240616.tar.gz
Algorithm Hash digest
SHA256 51f46996d18b42e8a006f3b99071caf5b3aef871d3bd7dc2a71863ad24cd0de6
MD5 64334634d9e1bd93122414373192b0c0
BLAKE2b-256 b13ef1c27189c1f793d95b41a45e021b67fe3f786a6a8559863d11c50ca171bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for model_providers-0.3.0.20240616-py3-none-any.whl
Algorithm Hash digest
SHA256 aff26e8b4d3b41c70215ba60c6d843bdba2b20f9bd494cf095d2fb727442bdf9
MD5 e3e012e6914e9b476a4267a5ee51e2ee
BLAKE2b-256 bae354e7fc56a3d230ef86cf182a2ae94e9ad21892359dcf65242a4411ab3add

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

This release

0.3.0.20240616 This release

2 files

0.3.0.20240612

2 files

0.3.0.20240610

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