Cohere-rerank-v3-english
Version: 1
Cohere Rerank English is the market’s leading reranking model used for semantic search and retrieval-augmented generation (RAG). Rerank enables you to significantly improve search quality by augmenting traditional key-word based search systems with a semantic-based reranking system which can contextualize the meaning of a user's query beyond keyword relevance. Cohere's Rerank delivers much higher quality results than just embedding-based search, lexical search and even hybrid search, and it requires only adding a single line of code into your application.
Rerank should be used as a ranker after initial retrieval (i.e. an initial search system finds the top-100 most relevant documents for a larger corpus of documents).
Rerank supports JSON objects as documents where users can specify at query time the fields (keys) that semantic search should be applied over.
- Context window of the model is 4096 tokens
- The max query length is 2048 tokens
How to use the model
Follow this article to deploy Cohere model with pay-as-you-go. Learn more about the Cohere model's request schema here .Inference samples
Sample Type | Sample Notebook |
---|---|
CLI using CURL and Python web requests | cohere-rerank.ipynb |
LangChain | langchain.ipynb |
Cohere SDK | cohere-sdk.ipynb |
Sample input
{
"query": "What is the capital of the United States?",
"rank_fields": ["Title", "Content"],
"documents": [
{"Title": "Facts about Carson City", "Content": "Carson City is the capital city of the American state of Nevada. "},
{"Title": "North Dakota", "Content" : "North Dakota is a state in the United States. 672,591 people lived in North Dakota in the year 2010. The capital and seat of government is Bismarck."},
{"Title": "Micronesia", "Content" : "Micronesia, officially the Federated States of Micronesia, is an island nation in the Pacific Ocean, northeast of Papua New Guinea. The country is a sovereign state in free association with the United States. The capital city of Federated States of Micronesia is Palikir."}
],
"top_n": 3
}
Sample output
{
"id": "571e6744-3074-457f-8935-08646a3352fb",
"results": [
{
"document": {
"Content": "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America.",
"Title": "Details about Washington D.C"
},
"index": 0,
"relevance_score": 0.98347044
},
{
"document": {
"Content": "Carson City is the capital city of the American state of Nevada. ",
"Title": "Facts about Carson City"
},
"index": 1,
"relevance_score": 0.07172112
},
{
"document": {
"Content": "Micronesia, officially the Federated States of Micronesia, is an island nation in the Pacific Ocean, northeast of Papua New Guinea. The country is a sovereign state in free association with the United States. The capital city of Federated States of Micronesia is Palikir.",
"Title": "Micronesia"
},
"index": 3,
"relevance_score": 0.05281402
},
{
"document": {
"Content": "North Dakota is a state in the United States. 672,591 people lived in North Dakota in the year 2010. The capital and seat of government is Bismarck.",
"Title": "North Dakota"
},
"index": 2,
"relevance_score": 0.03138043
}
]
}
Model Specifications
Context Length4096
LicenseCustom
Last UpdatedJuly 2024
Input TypeText
Output TypeText
PublisherCohere
Languages1 Language