BaseSparseEmbedding#

class langchain_milvus.utils.sparse.BaseSparseEmbedding[source]#

Interface for Sparse embedding models.

You can inherit from it and implement your custom sparse embedding model.

By default, the asynchronous methods are implemented using the synchronous methods; however, implementations may choose to override the asynchronous methods with an async native implementation for performance reasons.

Methods

aembed_documents(texts)

Asynchronous Embed search docs.

aembed_query(query)

Asynchronous Embed query text.

embed_documents(texts)

Embed search docs.

embed_query(query)

Embed query text.

async aembed_documents(
texts: list[str],
) List[Dict[int, float]][source]#

Asynchronous Embed search docs.

Parameters:

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

Returns:

List of embeddings.

Return type:

List[Dict[int, float]]

async aembed_query(
query: str,
) Dict[int, float][source]#

Asynchronous Embed query text.

Parameters:

query (str) – Text to embed.

Returns:

Embedding.

Return type:

Dict[int, float]

abstractmethod embed_documents(
texts: List[str],
) List[Dict[int, float]][source]#

Embed search docs.

Parameters:

texts (List[str])

Return type:

List[Dict[int, float]]

abstractmethod embed_query(
query: str,
) Dict[int, float][source]#

Embed query text.

Parameters:

query (str)

Return type:

Dict[int, float]