跳至内容

Cohere

本页面介绍如何在 LangChain 中使用 Cohere 生态系统。 它分为两个部分:安装和设置,以及对特定 Cohere 包装器的引用。

安装和设置

  • 使用 pip install cohere 安装 Python SDK。

  • 获取 Cohere API 密钥并将其设置为环境变量(COHERE_API_KEY)

包装器

LLM

存在一个 Cohere LLM 包装器,您可以使用它来访问

from langchain.llms import Cohere

嵌入

Cohere Embeddings 库提供了一个便于使用的包装器,您可以使用如下代码进行访问:

from langchain.embeddings import CohereEmbeddings

更多的详细信息以及演示可以参考 这个 notebook。