semantic_router.encoders.base
DenseEncoder Objects
set_score_threshold
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__
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
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
An encoder that encodes documents into a sparse format.
__call__
Encode a list of documents. Documents must be strings, sparse encoders do not
support other types.
Arguments:
docs
(List[str]
): The documents to encode.
Returns:
List[SparseEmbedding]
: The encoded documents.
acall
Encode a list of documents. Documents must be strings, sparse encoders do not
support other types.
Arguments:
docs
(List[str]
): The documents to encode.
Returns:
List[SparseEmbedding]
: The encoded documents.