Skip to content

Usage example in FastembedSparseDocumentEmbedder docstring raises TypeError #3729

Description

@keosung

Describe the bug
The usage example in the FastembedSparseDocumentEmbedder docstring ends with

print(f"Sparse Embedding Dimension: {len(result['documents'][0].sparse_embedding)}")

SparseEmbedding does not define __len__, so running the example as written fails:

TypeError: object of type 'SparseEmbedding' has no len()

Happy to open a PR with the one-line fix.

To Reproduce
Run the usage example from the FastembedSparseDocumentEmbedder docstring as is
(integrations/fastembed/src/haystack_integrations/components/embedders/fastembed/fastembed_sparse_document_embedder.py).

Describe your environment (please complete the following information):

  • OS: Ubuntu 24.04 LTS
  • Haystack version: 3.0.0
  • Integration version: current main

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions