SentenceTransformersDiversityRanker Parameters

Learn how to customize SentenceTransformersDiversityRanker.

YAML Init Parameters

These are the parameters you can pass to this component in the pipeline YAML configuration:

Parameter

Type

Possible values

Description

model

String

Default: sentence-transformers/all-MiniLM-L6-v2

Local path or name of the model in Hugging Face.
Required.

top_k

Integer

Default: 10

The maximum number of documents to return per query.
Required.

device

ComponentDevice

Default: None

The device on which the model is loaded. If None, the default device is automatically selected. Optional.

token

Secret

Default: Secret.from_env_var("HF_API_TOKEN", strict=False)

The API token used to download private models from Hugging Face. Optional.

similarity

Literal

dot_product
cosine
Default: cosine

Similarity metric for comparing embeddings.
Required.

query_prefix

String

Default: "" (empty string)

A string to add to the beginning of the query text before ranking. Can be used to prepend the text with an instruction, as required by some embedding models.
Required.

query_suffix

String

Default: "" (empty string)

A string to add to the end of the query text before ranking. Required.

document_prefix

String

Default: "" (empty string)

A string to add to the beginning of each document text before ranking. Can be used to prepend the text with an instruction, as required by some embedding models.
Required.

document_suffix

String

Default: "" (empty string)

A string to add to the end of each document text before ranking.
Required.

meta_fields_to_embed

List of strings

Default: None

List of metadata fields that should be embedded along with the document content. Optional.

embedding_separator

String

Default: "\n"

Separator used to concatenate the meta fields to the Document content.
Required.


REST API Runtime Parameters

There are no runtime parameters you can pass to this component when making a request to the Search REST API endpoint.