# FastEmbedSparse

> **Class** in `langchain_qdrant`

📖 [View in docs](https://reference.langchain.com/python/langchain-qdrant/fastembed_sparse/FastEmbedSparse)

An interface for sparse embedding models to use with Qdrant.

## Signature

```python
FastEmbedSparse(
    self,
    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 = {},
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `model_name` | `str` | No | The name of the model to use. (default: `'Qdrant/bm25'`) |
| `batch_size` | `int` | No | Batch size for encoding. (default: `256`) |
| `cache_dir` | `str` | No | The path to the model cache directory.                Can also be set using the                `FASTEMBED_CACHE_PATH` env variable. (default: `None`) |
| `threads` | `int` | No | The number of threads onnxruntime session can use. (default: `None`) |
| `providers` | `Sequence[Any]` | No | 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. (default: `None`) |
| `kwargs` | `Any` | No | Additional options to pass to `fastembed.SparseTextEmbedding` (default: `{}`) |

## Extends

- `SparseEmbeddings`

## Constructors

```python
__init__(
    self,
    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
```

| Name | Type |
|------|------|
| `model_name` | `str` |
| `batch_size` | `int` |
| `cache_dir` | `str \| None` |
| `threads` | `int \| None` |
| `providers` | `Sequence[Any] \| None` |
| `parallel` | `int \| None` |


## Methods

- [`embed_documents()`](https://reference.langchain.com/python/langchain-qdrant/fastembed_sparse/FastEmbedSparse/embed_documents)
- [`embed_query()`](https://reference.langchain.com/python/langchain-qdrant/fastembed_sparse/FastEmbedSparse/embed_query)

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/02991cb4cf2063d51a07268edafb05fe53de1826/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py#L11)