此功能仅在 Helm 图表版本 0.10.27(应用程序版本 0.10.74)及更高版本中可用。
许多模型提供商支持通过环境变量设置凭据和其他配置选项。这对于自托管部署很有用,因为您希望避免在代码或配置文件中硬编码敏感信息。在 LangSmith 中,大多数模型交互都是通过 playground 服务完成的,它允许您直接在 pod 本身上配置这些环境变量中的许多。这对于避免在 UI 中设置凭据很有用。

要求

  • 运行 playground 服务的自托管 LangSmith 实例。
  • 您要配置的提供商必须支持使用环境变量进行配置。查看提供商的 Chat Model 文档以获取更多信息。
  • 您可能想要附加到 playground 服务的密钥/角色。
    • 请注意,对于 IRSA,您可能需要授予 langsmith-playground 服务账户访问云提供商中密钥或角色所需的权限。

配置

使用上述参数,您可以配置 LangSmith 实例以使用环境变量作为模型提供商。您可以通过修改 LangSmith Helm Chart 安装的 langsmith_config.yaml 文件或 Docker 安装的 docker-compose.yaml 文件来完成此操作。
playground:
  deployment:
    extraEnv:
      - name: OPENAI_BASE_URL
        value: https://<my_proxy_url>
      - name: OPENAI_API_KEY
        valueFrom:
          secretKeyRef:
            name: <your_secret_name>
            key: api_key
  serviceAccount: # Can be useful if you want to use IRSA or workload identity
    annotations:
      eks.amazonaws.com/role-arn: <your_role_arn>

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.