Skip to content

[Bug]: SparseTextEmbedding needs to implement aembed for non-blocking use (async/await) #546

@sglebs

Description

@sglebs

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 langchain-ai/langchain#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions