Iembedding

Classes

class arshai.core.interfaces.iembedding.EmbeddingConfig(**data)[source]

Bases: IDTO

Configuration for embedding services.

model_name: Optional[str]
batch_size: int
additional_params: Dict[str, Any]
model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class arshai.core.interfaces.iembedding.IEmbedding(*args, **kwargs)[source]

Bases: Protocol

Interface defining the contract for embedding services. Any embedding service implementation must conform to this interface.

property dimension: int

Get the dimension of embeddings produced by this service.

Returns:

Dimension of the embedding vectors

Return type:

int

embed_documents(texts)[source]

Generate embeddings for multiple documents.

Parameters:

texts (List[str]) – List of text documents to embed

Return type:

Dict[str, Any]

Returns:

Dictionary containing embeddings with keys for different vector types (e.g., ‘dense’, ‘sparse’)

embed_document(text)[source]

Generate embeddings for a single document.

Parameters:

text (str) – Text document to embed

Return type:

Dict[str, Any]

Returns:

Dictionary containing embeddings with keys for different vector types (e.g., ‘dense’, ‘sparse’)

__init__(*args, **kwargs)