Docs Cloud Redpanda Connect Components Processors cohere_rerank cohere_rerank Available in: Cloud, Self-Managed Sends document strings to the Cohere API, which returns them ranked by their relevance to a specified query. The output of this processor is an array of strings, ordered by their relevance to the query. # Configuration fields, showing default values label: "" cohere_rerank: base_url: https://api.cohere.com api_key: "" # No default (required) model: rerank-v3.5 # No default (required) query: "" # No default (required) documents: "" # No default (required) top_n: 0 max_tokens_per_doc: 4096 Metadata relevance_scores: An array of scores for each input document that indicates how relevant it is to the query. The scores are in the same order as the documents in the input. The higher the score, the more relevant the document. Examples This pipeline reranks the input documents based on how closely they match the query specified in the cohere_rerank processor. input: generate: interval: 1s mapping: | root = { "query": fake("sentence"), "docs": [fake("paragraph"), fake("paragraph"), fake("paragraph")], } pipeline: processors: - cohere_rerank: model: rerank-v3.5 api_key: "${COHERE_API_KEY}" query: "${!this.query}" documents: "root = this.docs" output: stdout: {}``` Fields base_url The base URL to use for API requests. Type: string Default: https://api.cohere.com api_key Your API key for the Cohere API. This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Manage Secrets before adding it to your configuration. Type: string Default: "" model The name of the Cohere LLM you want to use. Type: string Default: "" # Examples model: rerank-v3.5 query The search query you want to execute. This field supports interpolation functions. Type: string Default: "" documents A list of text strings that are compared to the specified query. For optimal performance: Send fewer than 1000 documents in a single request Send structured data in YAML format Type: string Default: "" top_n The number of documents to return when the query is executed. If set to 0, all documents are returned. Type: int Default: 0 max_tokens_per_doc This processor automatically truncates long documents to the specified number of tokens. Type: int Default: 4096 Back to top × Simple online edits For simple changes, such as fixing a typo, you can edit the content directly on GitHub. Edit on GitHub Or, open an issue to let us know about something that you want us to change. Open an issue Contribution guide For extensive content updates, or if you prefer to work locally, read our contribution guide . Was this helpful? thumb_up thumb_down group Ask in the community mail Share your feedback group_add Make a contribution 🎉 Thanks for your feedback! cohere_embeddings compress