Skip to content

Add sparse embedders to Hugging Face API integration #3834

Description

@maxdswain

Is your feature request related to a problem? Please describe.
The Hugging Face API integration supports dense embeddings but not TEI's /embed_sparse endpoint, requiring custom components for sparse or hybrid retrieval.

Describe the solution you'd like
Add:

  • HuggingFaceAPISparseTextEmbedder
  • HuggingFaceAPISparseDocumentEmbedder

These should call /embed_sparse and return/populate Haystack SparseEmbedding objects.

Describe alternatives you've considered
Using a custom component or a different sparse embedding backend such as Sentence Transformers or FastEmbed.

Additional context
TEI supports sparse embeddings through /embed_sparse, including SPLADE-compatible models. Haystack already supports SparseEmbedding and Document.sparse_embedding, so the endpoint maps naturally to existing Haystack types.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions