Cohere

Cohere / Cohere / rerank-english-v2.0

AI ModelMilvus Integrated

TaskReranking

Modality文本

Similarity MetricN/A

License专有

Dimensions0

Max Input Tokens512

Price$2.00/1000次搜索

Cohere rerank-english-v2.0 简介

rerank-english-v2.0 是一个专门用于提高搜索和检索系统准确性的重排模型,能够根据相关性细化排名结果,可用于处理上下文长度为 512 个 Token 的英文文档。

更多重排和 Reranker 相关详情,请阅读博客:

如何使用 rerank-english-v2.0 对结果进行重排

主要有两种方式对搜索结果进行重排:

  • PyMilvusMilvus 的 Python SDK,无缝集成了rerank-english-v2.0 模型
  • Cohere 的 API

通过 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')

    准备好开始了吗?

    立刻创建 Zilliz Cloud 集群,存储和检索您的向量。

    免费试用 Zilliz Cloud