CohereRerankFunction
CohereRerankFunction は milvus_model のクラスで、query と document を入力として受け取り、embeddings の代わりに類似度スコアを直接返します。この機能は基盤となる Cohere reranking モデルを使用します。
python
pymilvus.model.reranker.CohereRerankFunction
Constructor
一般的なユースケース向けに CohereRerankFunction を構築します。
python
CohereRerankFunction(
model_name: str = "rerank-english-v2.0",
api_key: Optional[str] = None
)
PARAMETERS:
-
model_name (string)
使用するモデルの名前です。利用可能な Cohere reranker モデル名のいずれかを指定できます。たとえば、
rerank-english-v3.0、rerank-multilingual-v3.0などです。このパラメータを指定しない場合は、rerank-english-v2.0が使用されます。利用可能なモデルの一覧については、Rerank を参照してください。 -
api_key (string)
Cohere API にアクセスするための API key です。API key の作成方法については、Cohere dashboard を参照してください。
Examples
python
from pymilvus.model.reranker import CohereRerankFunction
# Define the rerank function
cohere_rf = CohereRerankFunction(
model_name="rerank-english-v3.0", # Specify the model name. Defaults to `rerank-english-v2.0`.
api_key=COHERE_API_KEY # Replace with your Cohere API key
)