Cohere / rerank-english-v2.0
Milvus 已集成
任务: Reranking
模态: 文本
相似度类型: N/A
许可证: 专有
向量维度: 0
最大输入 Token 数量: 512
定价: $2.00/1000次搜索
Cohere rerank-english-v2.0 简介
rerank-english-v2.0 是一个专门用于提高搜索和检索系统准确性的重排模型,能够根据相关性细化排名结果,可用于处理上下文长度为 512 个 Token 的英文文档。
更多重排和 Reranker 相关详情,请阅读博客:
- What Are Rerankers and How They Enhance Information Retrieval
- Optimizing RAG with Rerankers: The Role and Trade-offs
如何使用 rerank-english-v2.0 对结果进行重排
主要有两种方式对搜索结果进行重排:
通过 PyMilvus 进行重排
from pymilvus.model.reranker import CohereRerankFunction
rf = CohereRerankFunction(
model_name="rerank-english-v2.0",
api_key=COHERE_API_KEY
)
query = "What event in 1956 marked the official birth of artificial intelligence as a discipline?"
documents = ["In 1950, Alan Turing published his seminal paper, 'Computing Machinery and Intelligence,' proposing the Turing Test as a criterion of intelligence, a foundational concept in the philosophy and development of artificial intelligence.","The Dartmouth Conference in 1956 is considered the birthplace of artificial intelligence as a field; here, John McCarthy and others coined the term 'artificial intelligence' and laid out its basic goals.","In 1951, British mathematician and computer scientist Alan Turing also developed the first program designed to play chess, demonstrating an early example of AI in game strategy.","The invention of the Logic Theorist by Allen Newell, Herbert A. Simon, and Cliff Shaw in 1955 marked the creation of the first true AI program, which was capable of solving logic problems, akin to proving mathematical theorems."
]
results = rf(
query=query,
documents=documents,
top_k=4,
)
通过 Cohere API 进行重排
import cohereco = cohere.Client("your-cohere-api-key")
query = "What event in 1956 marked the official birth of artificial intelligence as a discipline?"
documents = ["In 1950, Alan Turing published his seminal paper, 'Computing Machinery and Intelligence,' proposing the Turing Test as a criterion of intelligence, a foundational concept in the philosophy and development of artificial intelligence.","The Dartmouth Conference in 1956 is considered the birthplace of artificial intelligence as a field; here, John McCarthy and others coined the term 'artificial intelligence' and laid out its basic goals.","In 1951, British mathematician and computer scientist Alan Turing also developed the first program designed to play chess, demonstrating an early example of AI in game strategy.","The invention of the Logic Theorist by Allen Newell, Herbert A. Simon, and Cliff Shaw in 1955 marked the creation of the first true AI program, which was capable of solving logic problems, akin to proving mathematical theorems."
]
results = co.rerank(query=query, documents=documents, top_n=4, model='rerank-english-v2.0')
- 更多详情,请参考文档
- 阅读 Cohere 重排最佳实践