FastEmbedSparse#
- class langchain_qdrant.fastembed_sparse.FastEmbedSparse(model_name: str = 'Qdrant/bm25', batch_size: int = 256, cache_dir: str | None = None, threads: int | None = None, providers: Sequence[Any] | None = None, parallel: int | None = None, **kwargs: Any)[source]#
An interface for sparse embedding models to use with Qdrant.
Sparse encoder implementation using FastEmbed - https://qdrant.github.io/fastembed/ For a list of available models, see https://qdrant.github.io/fastembed/examples/Supported_Models/
- Parameters:
model_name (str) β The name of the model to use. Defaults to βQdrant/bm25β.
batch_size (int) β Batch size for encoding. Defaults to 256.
cache_dir (str, optional) β The path to the model cache directory. Can also be set using the FASTEMBED_CACHE_PATH env variable.
threads (int, optional) β The number of threads onnxruntime session can use.
providers (Sequence[Any], optional) β List of ONNX execution providers. parallel (int, optional): If >1, data-parallel encoding will be used, r Recommended for encoding of large datasets. If 0, use all available cores. If None, donβt use data-parallel processing, use default onnxruntime threading instead. Defaults to None.
kwargs (Any) β Additional options to pass to fastembed.SparseTextEmbedding
parallel (int | None)
- Raises:
ValueError β If the model_name is not supported in SparseTextEmbedding.
Methods
__init__
([model_name,Β batch_size,Β ...])Sparse encoder implementation using FastEmbed - https://qdrant.github.io/fastembed/ For a list of available models, see https://qdrant.github.io/fastembed/examples/Supported_Models/
aembed_documents
(texts)Asynchronous Embed search docs.
aembed_query
(text)Asynchronous Embed query text.
embed_documents
(texts)Embed search docs.
embed_query
(text)Embed query text.
- __init__(model_name: str = 'Qdrant/bm25', batch_size: int = 256, cache_dir: str | None = None, threads: int | None = None, providers: Sequence[Any] | None = None, parallel: int | None = None, **kwargs: Any) None [source]#
Sparse encoder implementation using FastEmbed - https://qdrant.github.io/fastembed/ For a list of available models, see https://qdrant.github.io/fastembed/examples/Supported_Models/
- Parameters:
model_name (str) β The name of the model to use. Defaults to βQdrant/bm25β.
batch_size (int) β Batch size for encoding. Defaults to 256.
cache_dir (str, optional) β The path to the model cache directory. Can also be set using the FASTEMBED_CACHE_PATH env variable.
threads (int, optional) β The number of threads onnxruntime session can use.
providers (Sequence[Any], optional) β List of ONNX execution providers. parallel (int, optional): If >1, data-parallel encoding will be used, r Recommended for encoding of large datasets. If 0, use all available cores. If None, donβt use data-parallel processing, use default onnxruntime threading instead. Defaults to None.
kwargs (Any) β Additional options to pass to fastembed.SparseTextEmbedding
parallel (int | None)
- Raises:
ValueError β If the model_name is not supported in SparseTextEmbedding.
- Return type:
None
- async aembed_documents(texts: List[str]) List[SparseVector] #
Asynchronous Embed search docs.
- Parameters:
texts (List[str])
- Return type:
List[SparseVector]
- async aembed_query(text: str) SparseVector #
Asynchronous Embed query text.
- Parameters:
text (str)
- Return type:
- embed_documents(texts: List[str]) List[SparseVector] [source]#
Embed search docs.
- Parameters:
texts (List[str])
- Return type:
List[SparseVector]
- embed_query(text: str) SparseVector [source]#
Embed query text.
- Parameters:
text (str)
- Return type: