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

Uploaded Python 3

File details

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

File metadata

  • Download URL: model_providers-0.3.0.20240619.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.20240619.tar.gz
Algorithm Hash digest
SHA256 01694403e499c517bd3cea89185b925bc79d0cd34a5600c955c8d915c2026589
MD5 0baf69ba0d7eacd309083550ae9c5174
BLAKE2b-256 47b318230e221d9675a7b98505870d88870fc83c4e086df819a5873ba180144a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for model_providers-0.3.0.20240619-py3-none-any.whl
Algorithm Hash digest
SHA256 cb93cfcf2eb58c38a3f81dde3e70c5eb3ffac5161831b44079ad460c125121e2
MD5 97294439041e4f76431374920710572a
BLAKE2b-256 1eb5b3fbe416a2329b2eed7570dfbd8603a97ec8e806fda4b31797ef727b9b98

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

0.3.0.20240621

2 files

This release

0.3.0.20240619 This release

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

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