Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

Huggingface

在 LibreChat 中将 Huggingface 配置为自定义 endpoint。

Huggingface 通过 OpenAI 兼容的推理 API 提供托管模型,你可以将其作为自定义 endpoint 添加到 LibreChat 中。

获取 API key

huggingface.co/settings/tokens 创建一个 token。将其添加到你的 .env 文件中:

HUGGINGFACE_TOKEN=your-api-key

配置

在你的 librechat.yaml 中,将 endpoint 添加到 endpoints.custom 下:

    - name: 'HuggingFace'
      apiKey: '${HUGGINGFACE_TOKEN}'
      baseURL: 'https://api-inference.huggingface.co/v1'
      models:
        default: [
          "codellama/CodeLlama-34b-Instruct-hf",
          "google/gemma-1.1-2b-it",
          "google/gemma-1.1-7b-it",
          "HuggingFaceH4/starchat2-15b-v0.1",
          "HuggingFaceH4/zephyr-7b-beta",
          "meta-llama/Meta-Llama-3-8B-Instruct",
          "microsoft/Phi-3-mini-4k-instruct",
          "mistralai/Mistral-7B-Instruct-v0.1",
          "mistralai/Mistral-7B-Instruct-v0.2",
          "mistralai/Mixtral-8x7B-Instruct-v0.1",
          "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
        ]
        fetch: true
      titleConvo: true
      titleModel: "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO"
      dropParams: ["top_p"]
      modelDisplayLabel: "HuggingFace"

上述模型列表最后更新于 2024 年 5 月 9 日。

注意事项

  • 所列出的模型均为免费但受速率限制,且在免费层级下回答可能非常简短。某些模型的效果优于其他模型。
  • 不支持获取模型列表,因此请自行设置 default 数组。
  • dropParams: ["top_p"] 是必需的。如果没有它,请求将会失败,因为 Huggingface 会拒绝 top_p 参数。请参阅 dropParams

这篇指南怎么样?