airflow.providers.cohere.operators.rerank¶
Classes¶
Rerank documents by their relevance to a query using Cohere's Rerank API. |
Module Contents¶
- class airflow.providers.cohere.operators.rerank.CohereRerankOperator(*, query, documents, model=None, top_n=None, max_tokens_per_doc=None, conn_id=CohereHook.default_conn_name, timeout=None, request_options=None, **kwargs)[source]¶
Bases:
airflow.providers.common.compat.sdk.BaseOperatorRerank documents by their relevance to a query using Cohere’s Rerank API.
See also
For more information on how to use this operator, take a look at the guide: CohereRerankOperator
- Parameters:
query (str) – The search query used to rank the documents.
documents (list[str]) – Text documents to compare with the query.
model (str | None) – Model to use for reranking. Uses the hook’s default when omitted.
top_n (int | None) – Maximum number of ranked documents to return. By default, all are returned.
max_tokens_per_doc (int | None) – Maximum number of tokens retained from each document.
conn_id (str) – Cohere connection id.
timeout (int | None) – Request timeout in seconds.
request_options (cohere.core.request_options.RequestOptions | None) – Request-specific configuration passed to the Cohere client.
- template_fields: collections.abc.Sequence[str] = ('query', 'documents', 'top_n', 'max_tokens_per_doc')[source]¶
- property hook: airflow.providers.cohere.hooks.cohere.CohereHook[source]¶
Return a Cohere hook.