Cohere Rerank on LangChain (Integration Guide)
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 Rerank with LangChain.
Prerequisites
Running Cohere Rerank with LangChain doesn’t require many prerequisites, consult the top-level document for more information.
Cohere ReRank with LangChain
To use Cohere’s rerank functionality with LangChain, start with instantiating a CohereRerank object as follows: cohere_rerank = CohereRerank(cohere_api_key="{API_KEY}")
.
You can then use it with LangChain retrievers, embeddings, and RAG. The example below uses the vector DB chroma, for which you will need to install pip install chromadb
. Other vector DB’s from this list can also be used.
Using LangChain on Private Deployments
You can use LangChain with privately deployed Cohere models. To use it, specify your model deployment URL in the base_url
parameter.