Embed on LangChain
Cohere supports various integrations with LangChain, a large language model (LLM) framework which allows you to quickly create applications based on Cohere’s models. This doc will guide you through how to leverage different Cohere embeddings with LangChain.
Prerequisites
Running Cohere embeddings with LangChain doesn’t require many prerequisites, consult the top-level document for more information.
Cohere Embeddings with LangChain
To use Cohere’s Embeddings with LangChain, create a CohereEmbedding object as follows (the available cohere embedding models are listed here):
To use these embeddings with Cohere’s RAG functionality, you will need to use one of the vector DBs from this list. In this example we use chroma, so in order to run it you will need to install chroma using pip install chromadb
.
Cohere with LangChain and Bedrock
Prerequisite
In addition to the prerequisites above, integrating Cohere with LangChain on Amazon Bedrock also requires:
- AWS Python SDK. To install it, run
pip install boto3
. You can find more details here . - Configured authentication credentials for AWS. For more details, see this document.
Cohere Embeddings with LangChain and Amazon Bedrock
In this example, we create embeddings for a query using Bedrock and LangChain: