JinaRanker
Rank documents based on their similarity to the query using Jina AI models.
Basic Information
- Pipeline type: Query
- Components that can precede it in a pipeline: Retriever
- Components that can follow it in a pipeline:
- Required inputs:
- "query": The query string.
- "documents": A list of documents to rank.
- Optional inputs:
- "top_k": The maximum number of documents you want the ranker to return. If not provided, the ranker outputs all documents it received.
- "score_threshold": If provided, only returns documents above this threshold.
- Outputs:
A dictionary with the following key:- "documents": A list of documents that are most semantically similar to the query. The documents are ranked by most similar first.
Overview
JinaRanker uses the jina-reranker-v1-base-en
model by default. You can replace it with any other supported model. Check the Jina website for available reranker models.
Authorization
You need an active Jina API key to use this component. By default, JinaRanker uses the JINA_API_KEY
environment variable, but you can also pass the key to the api_key
parameter.
Usage Example
Parameters
Parameter | Type | Possible values | Description |
---|---|---|---|
model | String | Default: jina-reranker-v1-base-en | The name of the Jina model to use. Check the list of available models on Jina's website. Required. |
api_key | Secret | Default: Secret = Secret.from_env_var("JINA_API_KEY") | The Jina API key. It can be explicitly provided or automatically read from the environment variable JINA_API_KEY (recommended). Required. |
top_k | Integer | Default: None | The maximum number of documents to return per query. If None , all documents are returned.Optional. |
score_threshold | Float | Default: None | If provided, only returns documents with a score above this threshold. Optional. |
Updated 5 months ago
Related Links