02. Cohere Reranker

Cohere arrow-up-rightIs a Canadian startup that provides a natural language processing model that helps companies improve human-machine interaction.

This laptop retriever in Cohere rerank endpoint arrow-up-rightShows how to use.

Copy

# installation
# !pip install -qU cohere

Cohere API key setting

Reference - Official document arrow-up-right- Reranker Model Listarrow-up-right

Copy

# API KEY A configuration file for managing environment variables
from dotenv import load_dotenv

# API KEY load information
load_dotenv()

Copy

 True 

Copy

Copy

Usage

Copy

Cohere multilingual support model

  • Embedding: embed-multilingual-v3.0 , embed-multilingual-light-v3.0 , embed-multilingual-v2.0

  • Reranker: rerank-multilingual-v3.0 , rerank-multilingual-v2.0

Copy

Copy

Rearrangement using CohereRerank

Now the basics retriever for ContextualCompressionRetriever I'll wrap it up with. Rearrange returned results using the Cohere rearrangement endpoint CohereRerank Will add Note that it is essential to name the model in CohereRerank!

Copy

Copy

Last updated