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

Cohere

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

Cohere 提供了 Command 系列模型,在 LibreChat 中作为自定义 endpoint 使用。其 API 不遵循 OpenAI 规范,因此它依赖于一个映射了部分参数的兼容层。

获取 API key

Cohere dashboard 创建一个密钥。将其添加到你的 .env 文件中:

COHERE_API_KEY=your-api-key

配置

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

    - name: "cohere"
      apiKey: "${COHERE_API_KEY}"
      baseURL: "https://api.cohere.ai/v1"
      models:
        default: ["command-r","command-r-plus","command-light","command-light-nightly","command","command-nightly"]
        fetch: false
      modelDisplayLabel: "cohere"
      titleModel: "command"
      dropParams: ["stop", "user", "frequency_penalty", "presence_penalty", "temperature", "top_p"]

注意事项

  • Cohere 不遵循 OpenAI 规范。一个兼容层将 OpenAI 参数的子集映射到 Cohere 的对应参数:stop 映射为 stopSequencestop_p 映射为 pfrequency_penalty 映射为 frequencyPenaltypresence_penalty 映射为 presencePenalty(每个参数的最小/最大范围各不相同)。modelstream 是共享的,默认会发送;max_tokens 映射为 maxTokens,但默认不会发送。上面的示例使用了 dropParams 来移除其中大部分参数,并回退到 Cohere 的默认设置。
  • 有关 Cohere 特定参数的完整列表,请参阅 Cohere API documentation

这篇指南怎么样?