DenseEncoder Objects

class DenseEncoder(BaseModel)

set_score_threshold

@field_validator("score_threshold")
def set_score_threshold(cls, v: float | None) -> float | None
Set the score threshold. If None, the score threshold is not used. Arguments:
  • v (float | None): The score threshold.
Returns: float | None: The score threshold.

__call__

def __call__(docs: List[Any]) -> List[List[float]]
Encode a list of documents. Documents can be any type, but the encoder must be built to handle that data type. Typically, these types are strings or arrays representing images. Arguments:
  • docs (List[Any]): The documents to encode.
Returns: List[List[float]]: The encoded documents.

acall

async def acall(docs: List[Any]) -> List[List[float]]
Encode a list of documents asynchronously. Documents can be any type, but the encoder must be built to handle that data type. Typically, these types are strings or arrays representing images. Arguments:
  • docs (List[Any]): The documents to encode.
Returns: List[List[float]]: The encoded documents.

SparseEncoder Objects

class SparseEncoder(BaseModel)
An encoder that encodes documents into a sparse format.

__call__

def __call__(docs: List[str]) -> List[SparseEmbedding]
Sparsely encode a list of documents. Documents can be any type, but the encoder must be built to handle that data type. Typically, these types are strings or arrays representing images. Arguments:
  • docs (List[Any]): The documents to encode.
Returns: List[SparseEmbedding]: The encoded documents.

acall

async def acall(docs: List[Any]) -> List[SparseEmbedding]
Encode a list of documents asynchronously. Documents can be any type, but the encoder must be built to handle that data type. Typically, these types are strings or arrays representing images. Arguments:
  • docs (List[Any]): The documents to encode.
Returns: List[SparseEmbedding]: The encoded documents.

AsymmetricDenseMixin Objects

class AsymmetricDenseMixin()

encode_queries

def encode_queries(docs: List[str]) -> List[List[float]]
Convert query texts to dense embeddings optimized for querying

encode_documents

def encode_documents(docs: List[str]) -> List[List[float]]
Convert document texts to dense embeddings optimized for storage

aencode_queries

async def aencode_queries(docs: List[str]) -> List[List[float]]
Async version of encode_queries

aencode_documents

async def aencode_documents(docs: List[str]) -> List[List[float]]
Async version of encode_documents

AsymmetricSparseMixin Objects

class AsymmetricSparseMixin()

encode_queries

def encode_queries(docs: List[str]) -> List[SparseEmbedding]
Convert query texts to dense embeddings optimized for querying

encode_documents

def encode_documents(docs: List[str]) -> List[SparseEmbedding]
Convert document texts to dense embeddings optimized for storage

aencode_queries

async def aencode_queries(docs: List[str]) -> List[SparseEmbedding]
Async version of encode_queries

aencode_documents

async def aencode_documents(docs: List[str]) -> List[SparseEmbedding]
Async version of encode_documents