pyseekdb.utils.embedding_functions.Text2VecEmbeddingFunction

class pyseekdb.utils.embedding_functions.Text2VecEmbeddingFunction(model_name: str = 'shibing624/text2vec-base-chinese', device: str = 'cpu', normalize_embeddings: bool = False, **kwargs: Any)[source]

Bases: EmbeddingFunction[str | list[str]]

An embedding function using text2vec with a specific model.

Text2Vec provides multilingual embeddings (supports 100+ languages) with various pretrained models.

__init__(model_name: str = 'shibing624/text2vec-base-chinese', device: str = 'cpu', normalize_embeddings: bool = False, **kwargs: Any)[source]

Initialize Text2VecEmbeddingFunction.

Methods

__init__([model_name, device, ...])

Initialize Text2VecEmbeddingFunction.

build_from_config(config)

Build Text2VecEmbeddingFunction from configuration dictionary.

get_config()

Get configuration dictionary for serialization.

name()

Return the embedding function name identifier.

support_persistence(embedding_function)

Check if the embedding function supports persistence.

Attributes

dimension

Get the dimension of embeddings produced by this function.

models

static build_from_config(config: dict[str, Any]) Text2VecEmbeddingFunction[source]

Build Text2VecEmbeddingFunction from configuration dictionary.

property dimension: int

Get the dimension of embeddings produced by this function.

get_config() dict[str, Any][source]

Get configuration dictionary for serialization.

static name() str[source]

Return the embedding function name identifier.