[Bug]: SparseTextEmbedding needs to implement aembed for non-blocking use (async/await)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.2k
- Forks
- 248
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 4
Description
What happened?
I want to be able to use non-blocking embedding, via "aembed" (async/await). This API is missing in this class, but it is part of the expected contract.
What is the expected behaviour?
When an AsyncQdrantClient is used, aembed can be used (async/await) as well. I am talking about https://github.com/langchain-ai/langchain/issues/32195 and testing the patch https://github.com/langchain-ai/langchain/pull/32196/files#r2226270515
I tried a hybrid search and, fair enough, "aembed" works fine with the dense variation but not with the sparse one (fast-sparse-bm25)
A minimal reproducible example
from fastembed.sparse.sparse_text_embedding import SparseTextEmbedding
embedding = SparseTextEmbedding('Qdrant/bm25')
embedding.aembed_query("foo bar")
embedding.aembed_query("foo bar")
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SparseTextEmbedding' object has no attribute 'aembed_query'
What Python version are you on? e.g. python --version
Python 3.11.10
FastEmbed version
fastembed==0.7.1
What os are you seeing the problem on?
MacOS
Relevant stack traces and/or logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in fastembed/sparse/sparse_text_embedding.py and compare the sparse class's public API with the async usage shown in the report. Reproduce SparseTextEmbedding('Qdrant/bm25').aembed_query("foo bar") and verify that async/await use no longer raises AttributeError; the expected behavior is an available non-blocking embedding method.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, machine-learning, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100