Saltar al contenido principal

E5Embedding

DenseEmbedding
DashAI.back.models.RAG.embeddings.dense.E5Embedding

Dense embeddings using E5 models with average pooling + L2 normalization.

Automatically prepends "query: " or "passage: " prefixes to input text (see :class:_E5Embedding).

Wraps :class:_E5Embedding and exposes it as a DashAI component with a configurable schema (:class:E5EmbeddingSchema).

Parameters​

model_name : string, default=intfloat/e5-small-v2
E5 model for embedding generation (uses query/passage prefixes).
overflow_strategy : string, default=truncate
Strategy for chunks exceeding model max sequence length.
device : string, default=cpu
Device to run the model on.

Methods​

batch_encode(self, texts: List[str])

Defined on E5Embedding

Encode a batch of texts into dense embeddings (prepends "passage: ").

encode(self, text: str)

Defined on E5Embedding

Encode a single text into a dense embedding (prepends "query: ").

load(self)

Defined on E5Embedding

Load the E5 model and tokenizer.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.