fastembed-haystack 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. fastembed_haystack-1.3.0/CHANGELOG.md +63 -0
  2. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/PKG-INFO +1 -1
  3. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/examples/example.py +1 -0
  4. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/examples/sparse_example.py +1 -0
  5. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/pyproject.toml +11 -7
  6. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/embedding_backend/fastembed_backend.py +16 -4
  7. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_sparse_document_embedder.py +5 -0
  8. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_sparse_text_embedder.py +5 -0
  9. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/tests/test_fastembed_backend.py +26 -0
  10. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/tests/test_fastembed_document_embedder.py +1 -0
  11. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/tests/test_fastembed_sparse_document_embedder.py +54 -1
  12. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/tests/test_fastembed_sparse_text_embedder.py +56 -1
  13. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/tests/test_fastembed_text_embedder.py +1 -0
  14. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/.gitignore +0 -0
  15. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/LICENSE.txt +0 -0
  16. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/README.md +0 -0
  17. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/pydoc/config.yml +0 -0
  18. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/__init__.py +0 -0
  19. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/embedding_backend/__init__.py +0 -0
  20. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_document_embedder.py +0 -0
  21. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_text_embedder.py +0 -0
  22. {fastembed_haystack-1.2.0 → fastembed_haystack-1.3.0}/tests/__init__.py +0 -0
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ ## [unreleased]
4
+
5
+ ### ⚙️ Miscellaneous Tasks
6
+
7
+ - Retry tests to reduce flakyness (#836)
8
+ - Update ruff invocation to include check parameter (#853)
9
+
10
+ ### Fix
11
+
12
+ - Typo on Sparse embedders. The parameter should be "progress_bar" … (#814)
13
+
14
+ ## [integrations/fastembed-v1.1.0] - 2024-05-15
15
+
16
+ ## [integrations/fastembed-v1.0.0] - 2024-05-06
17
+
18
+ ## [integrations/fastembed-v0.1.0] - 2024-04-10
19
+
20
+ ### 🚀 Features
21
+
22
+ - *(FastEmbed)* Support for SPLADE Sparse Embedder (#579)
23
+
24
+ ### 📚 Documentation
25
+
26
+ - Disable-class-def (#556)
27
+
28
+ ## [integrations/fastembed-v0.0.6] - 2024-03-07
29
+
30
+ ### 📚 Documentation
31
+
32
+ - Review and normalize docstrings - `integrations.fastembed` (#519)
33
+ - Small consistency improvements (#536)
34
+
35
+ ## [integrations/fastembed-v0.0.5] - 2024-02-20
36
+
37
+ ### 🐛 Bug Fixes
38
+
39
+ - Fix order of API docs (#447)
40
+
41
+ This PR will also push the docs to Readme
42
+
43
+ ### 📚 Documentation
44
+
45
+ - Update category slug (#442)
46
+
47
+ ## [integrations/fastembed-v0.0.4] - 2024-02-16
48
+
49
+ ## [integrations/fastembed-v0.0.3] - 2024-02-12
50
+
51
+ ### 🐛 Bug Fixes
52
+
53
+ - From numpy float to float (#391)
54
+
55
+ ### 📚 Documentation
56
+
57
+ - Update paths and titles (#397)
58
+
59
+ ## [integrations/fastembed-v0.0.2] - 2024-02-11
60
+
61
+ ## [integrations/fastembed-v0.0.1] - 2024-02-10
62
+
63
+ <!-- generated by git-cliff -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fastembed-haystack
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Haystack 2.x component to embed strings and Documents using fastembed embedding model
5
5
  Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations
6
6
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/fastembed/README.md
@@ -1,6 +1,7 @@
1
1
  from haystack import Document, Pipeline
2
2
  from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
3
3
  from haystack.document_stores.in_memory import InMemoryDocumentStore
4
+
4
5
  from haystack_integrations.components.embedders.fastembed import FastembedDocumentEmbedder, FastembedTextEmbedder
5
6
 
6
7
  document_store = InMemoryDocumentStore(embedding_similarity_function="cosine")
@@ -4,6 +4,7 @@
4
4
  # involving indexing and retrieval of documents.
5
5
 
6
6
  from haystack import Document
7
+
7
8
  from haystack_integrations.components.embedders.fastembed import FastembedSparseDocumentEmbedder
8
9
 
9
10
  document_list = [
@@ -50,10 +50,12 @@ dependencies = [
50
50
  "haystack-pydoc-tools",
51
51
  ]
52
52
  [tool.hatch.envs.default.scripts]
53
- test = "pytest --reruns 3 --reruns-delay 30 -x {args:tests}"
54
- test-cov = "coverage run -m pytest --reruns 3 --reruns-delay 30 -x {args:tests}"
53
+ test = "pytest {args:tests}"
54
+ test-cov = "coverage run -m pytest {args:tests}"
55
+ test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x"
55
56
  cov-report = ["- coverage combine", "coverage report"]
56
57
  cov = ["test-cov", "cov-report"]
58
+ cov-retry = ["test-cov-retry", "cov-report"]
57
59
  docs = ["pydoc-markdown pydoc/config.yml"]
58
60
 
59
61
  [[tool.hatch.envs.all.matrix]]
@@ -65,7 +67,7 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243", "numpy"]
65
67
  [tool.hatch.envs.lint.scripts]
66
68
  typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
67
69
  style = ["ruff check {args:.}", "black --check --diff {args:.}"]
68
- fmt = ["black {args:.}", "ruff --fix {args:.}", "style"]
70
+ fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
69
71
  all = ["style", "typing"]
70
72
 
71
73
  [tool.black]
@@ -76,6 +78,8 @@ skip-string-normalization = true
76
78
  [tool.ruff]
77
79
  target-version = "py38"
78
80
  line-length = 120
81
+
82
+ [tool.ruff.lint]
79
83
  select = [
80
84
  "A",
81
85
  "ARG",
@@ -126,13 +130,13 @@ unfixable = [
126
130
  "F401",
127
131
  ]
128
132
 
129
- [tool.ruff.isort]
130
- known-first-party = ["src"]
133
+ [tool.ruff.lint.isort]
134
+ known-first-party = ["haystack_integrations"]
131
135
 
132
- [tool.ruff.flake8-tidy-imports]
136
+ [tool.ruff.lint.flake8-tidy-imports]
133
137
  ban-relative-imports = "parents"
134
138
 
135
- [tool.ruff.per-file-ignores]
139
+ [tool.ruff.lint.per-file-ignores]
136
140
  # Tests can use magic values, assertions, and relative imports
137
141
  "tests/**/*" = ["PLR2004", "S101", "TID252"]
138
142
  # examples can contain "print" commands
@@ -1,4 +1,4 @@
1
- from typing import ClassVar, Dict, List, Optional
1
+ from typing import Any, ClassVar, Dict, List, Optional
2
2
 
3
3
  from haystack.dataclasses.sparse_embedding import SparseEmbedding
4
4
  from tqdm import tqdm
@@ -73,14 +73,19 @@ class _FastembedSparseEmbeddingBackendFactory:
73
73
  cache_dir: Optional[str] = None,
74
74
  threads: Optional[int] = None,
75
75
  local_files_only: bool = False,
76
+ model_kwargs: Optional[Dict[str, Any]] = None,
76
77
  ):
77
- embedding_backend_id = f"{model_name}{cache_dir}{threads}"
78
+ embedding_backend_id = f"{model_name}{cache_dir}{threads}{local_files_only}{model_kwargs}"
78
79
 
79
80
  if embedding_backend_id in _FastembedSparseEmbeddingBackendFactory._instances:
80
81
  return _FastembedSparseEmbeddingBackendFactory._instances[embedding_backend_id]
81
82
 
82
83
  embedding_backend = _FastembedSparseEmbeddingBackend(
83
- model_name=model_name, cache_dir=cache_dir, threads=threads, local_files_only=local_files_only
84
+ model_name=model_name,
85
+ cache_dir=cache_dir,
86
+ threads=threads,
87
+ local_files_only=local_files_only,
88
+ model_kwargs=model_kwargs,
84
89
  )
85
90
  _FastembedSparseEmbeddingBackendFactory._instances[embedding_backend_id] = embedding_backend
86
91
  return embedding_backend
@@ -97,9 +102,16 @@ class _FastembedSparseEmbeddingBackend:
97
102
  cache_dir: Optional[str] = None,
98
103
  threads: Optional[int] = None,
99
104
  local_files_only: bool = False,
105
+ model_kwargs: Optional[Dict[str, Any]] = None,
100
106
  ):
107
+ model_kwargs = model_kwargs or {}
108
+
101
109
  self.model = SparseTextEmbedding(
102
- model_name=model_name, cache_dir=cache_dir, threads=threads, local_files_only=local_files_only
110
+ model_name=model_name,
111
+ cache_dir=cache_dir,
112
+ threads=threads,
113
+ local_files_only=local_files_only,
114
+ **model_kwargs,
103
115
  )
104
116
 
105
117
  def embed(self, data: List[List[str]], progress_bar=True, **kwargs) -> List[SparseEmbedding]:
@@ -62,6 +62,7 @@ class FastembedSparseDocumentEmbedder:
62
62
  local_files_only: bool = False,
63
63
  meta_fields_to_embed: Optional[List[str]] = None,
64
64
  embedding_separator: str = "\n",
65
+ model_kwargs: Optional[Dict[str, Any]] = None,
65
66
  ):
66
67
  """
67
68
  Create an FastembedDocumentEmbedder component.
@@ -81,6 +82,7 @@ class FastembedSparseDocumentEmbedder:
81
82
  :param local_files_only: If `True`, only use the model files in the `cache_dir`.
82
83
  :param meta_fields_to_embed: List of meta fields that should be embedded along with the Document content.
83
84
  :param embedding_separator: Separator used to concatenate the meta fields to the Document content.
85
+ :param model_kwargs: Dictionary containing model parameters such as `k`, `b`, `avg_len`, `language`.
84
86
  """
85
87
 
86
88
  self.model_name = model
@@ -92,6 +94,7 @@ class FastembedSparseDocumentEmbedder:
92
94
  self.local_files_only = local_files_only
93
95
  self.meta_fields_to_embed = meta_fields_to_embed or []
94
96
  self.embedding_separator = embedding_separator
97
+ self.model_kwargs = model_kwargs
95
98
 
96
99
  def to_dict(self) -> Dict[str, Any]:
97
100
  """
@@ -110,6 +113,7 @@ class FastembedSparseDocumentEmbedder:
110
113
  local_files_only=self.local_files_only,
111
114
  meta_fields_to_embed=self.meta_fields_to_embed,
112
115
  embedding_separator=self.embedding_separator,
116
+ model_kwargs=self.model_kwargs,
113
117
  )
114
118
 
115
119
  def warm_up(self):
@@ -122,6 +126,7 @@ class FastembedSparseDocumentEmbedder:
122
126
  cache_dir=self.cache_dir,
123
127
  threads=self.threads,
124
128
  local_files_only=self.local_files_only,
129
+ model_kwargs=self.model_kwargs,
125
130
  )
126
131
 
127
132
  def _prepare_texts_to_embed(self, documents: List[Document]) -> List[str]:
@@ -35,6 +35,7 @@ class FastembedSparseTextEmbedder:
35
35
  progress_bar: bool = True,
36
36
  parallel: Optional[int] = None,
37
37
  local_files_only: bool = False,
38
+ model_kwargs: Optional[Dict[str, Any]] = None,
38
39
  ):
39
40
  """
40
41
  Create a FastembedSparseTextEmbedder component.
@@ -50,6 +51,7 @@ class FastembedSparseTextEmbedder:
50
51
  If 0, use all available cores.
51
52
  If None, don't use data-parallel processing, use default onnxruntime threading instead.
52
53
  :param local_files_only: If `True`, only use the model files in the `cache_dir`.
54
+ :param model_kwargs: Dictionary containing model parameters such as `k`, `b`, `avg_len`, `language`.
53
55
  """
54
56
 
55
57
  self.model_name = model
@@ -58,6 +60,7 @@ class FastembedSparseTextEmbedder:
58
60
  self.progress_bar = progress_bar
59
61
  self.parallel = parallel
60
62
  self.local_files_only = local_files_only
63
+ self.model_kwargs = model_kwargs
61
64
 
62
65
  def to_dict(self) -> Dict[str, Any]:
63
66
  """
@@ -74,6 +77,7 @@ class FastembedSparseTextEmbedder:
74
77
  progress_bar=self.progress_bar,
75
78
  parallel=self.parallel,
76
79
  local_files_only=self.local_files_only,
80
+ model_kwargs=self.model_kwargs,
77
81
  )
78
82
 
79
83
  def warm_up(self):
@@ -86,6 +90,7 @@ class FastembedSparseTextEmbedder:
86
90
  cache_dir=self.cache_dir,
87
91
  threads=self.threads,
88
92
  local_files_only=self.local_files_only,
93
+ model_kwargs=self.model_kwargs,
89
94
  )
90
95
 
91
96
  @component.output_types(sparse_embedding=SparseEmbedding)
@@ -2,6 +2,7 @@ from unittest.mock import patch
2
2
 
3
3
  from haystack_integrations.components.embedders.fastembed.embedding_backend.fastembed_backend import (
4
4
  _FastembedEmbeddingBackendFactory,
5
+ _FastembedSparseEmbeddingBackendFactory,
5
6
  )
6
7
 
7
8
 
@@ -44,3 +45,28 @@ def test_embedding_function_with_kwargs(mock_instructor): # noqa: ARG001
44
45
  embedding_backend.model.embed.assert_called_once_with(data)
45
46
  # restore the factory stateTrue
46
47
  _FastembedEmbeddingBackendFactory._instances = {}
48
+
49
+
50
+ @patch("haystack_integrations.components.embedders.fastembed.embedding_backend.fastembed_backend.SparseTextEmbedding")
51
+ def test_model_kwargs_initialization(mock_instructor):
52
+ bm25_config = {
53
+ "k": 1.2,
54
+ "b": 0.75,
55
+ "avg_len": 300.0,
56
+ "language": "english",
57
+ "token_max_length": 40,
58
+ }
59
+
60
+ # Invoke the backend factory with the BM25 configuration
61
+ _FastembedSparseEmbeddingBackendFactory.get_embedding_backend(
62
+ model_name="Qdrant/bm25",
63
+ model_kwargs=bm25_config,
64
+ )
65
+
66
+ # Check if SparseTextEmbedding was called with the correct arguments
67
+ mock_instructor.assert_called_once_with(
68
+ model_name="Qdrant/bm25", cache_dir=None, threads=None, local_files_only=False, **bm25_config
69
+ )
70
+
71
+ # Restore factory state after the test
72
+ _FastembedSparseEmbeddingBackendFactory._instances = {}
@@ -3,6 +3,7 @@ from unittest.mock import MagicMock, patch
3
3
  import numpy as np
4
4
  import pytest
5
5
  from haystack import Document, default_from_dict
6
+
6
7
  from haystack_integrations.components.embedders.fastembed.fastembed_document_embedder import (
7
8
  FastembedDocumentEmbedder,
8
9
  )
@@ -4,6 +4,7 @@ import numpy as np
4
4
  import pytest
5
5
  from haystack import Document, default_from_dict
6
6
  from haystack.dataclasses.sparse_embedding import SparseEmbedding
7
+
7
8
  from haystack_integrations.components.embedders.fastembed.fastembed_sparse_document_embedder import (
8
9
  FastembedSparseDocumentEmbedder,
9
10
  )
@@ -68,6 +69,7 @@ class TestFastembedSparseDocumentEmbedderDoc:
68
69
  "local_files_only": False,
69
70
  "embedding_separator": "\n",
70
71
  "meta_fields_to_embed": [],
72
+ "model_kwargs": None,
71
73
  },
72
74
  }
73
75
 
@@ -99,6 +101,7 @@ class TestFastembedSparseDocumentEmbedderDoc:
99
101
  "local_files_only": True,
100
102
  "meta_fields_to_embed": ["test_field"],
101
103
  "embedding_separator": " | ",
104
+ "model_kwargs": None,
102
105
  },
103
106
  }
104
107
 
@@ -173,7 +176,11 @@ class TestFastembedSparseDocumentEmbedderDoc:
173
176
  mocked_factory.get_embedding_backend.assert_not_called()
174
177
  embedder.warm_up()
175
178
  mocked_factory.get_embedding_backend.assert_called_once_with(
176
- model_name="prithvida/Splade_PP_en_v1", cache_dir=None, threads=None, local_files_only=False
179
+ model_name="prithvida/Splade_PP_en_v1",
180
+ cache_dir=None,
181
+ threads=None,
182
+ local_files_only=False,
183
+ model_kwargs=None,
177
184
  )
178
185
 
179
186
  @patch(
@@ -274,6 +281,52 @@ class TestFastembedSparseDocumentEmbedderDoc:
274
281
  parallel=None,
275
282
  )
276
283
 
284
+ def test_init_with_model_kwargs_parameters(self):
285
+ """
286
+ Test initialization of FastembedSparseDocumentEmbedder with model_kwargs parameters.
287
+ """
288
+ bm25_config = {
289
+ "k": 1.2,
290
+ "b": 0.75,
291
+ "avg_len": 300.0,
292
+ "language": "english",
293
+ "token_max_length": 50,
294
+ }
295
+
296
+ embedder = FastembedSparseDocumentEmbedder(
297
+ model="Qdrant/bm25",
298
+ model_kwargs=bm25_config,
299
+ )
300
+
301
+ assert embedder.model_kwargs == bm25_config
302
+
303
+ @pytest.mark.integration
304
+ def test_run_with_model_kwargs(self):
305
+ """
306
+ Integration test to check the embedding with model_kwargs parameters.
307
+ """
308
+ bm42_config = {
309
+ "alpha": 0.2,
310
+ }
311
+
312
+ embedder = FastembedSparseDocumentEmbedder(
313
+ model="Qdrant/bm42-all-minilm-l6-v2-attentions",
314
+ model_kwargs=bm42_config,
315
+ )
316
+ embedder.warm_up()
317
+
318
+ doc = Document(content="Example content using BM42")
319
+
320
+ result = embedder.run(documents=[doc])
321
+ embedding = result["documents"][0].sparse_embedding
322
+ embedding_dict = embedding.to_dict()
323
+
324
+ assert isinstance(embedding, SparseEmbedding)
325
+ assert isinstance(embedding_dict["indices"], list)
326
+ assert isinstance(embedding_dict["values"], list)
327
+ assert isinstance(embedding_dict["indices"][0], int)
328
+ assert isinstance(embedding_dict["values"][0], float)
329
+
277
330
  @pytest.mark.integration
278
331
  def test_run(self):
279
332
  embedder = FastembedSparseDocumentEmbedder(
@@ -4,6 +4,7 @@ import numpy as np
4
4
  import pytest
5
5
  from haystack import default_from_dict
6
6
  from haystack.dataclasses.sparse_embedding import SparseEmbedding
7
+
7
8
  from haystack_integrations.components.embedders.fastembed.fastembed_sparse_text_embedder import (
8
9
  FastembedSparseTextEmbedder,
9
10
  )
@@ -53,6 +54,7 @@ class TestFastembedSparseTextEmbedder:
53
54
  "progress_bar": True,
54
55
  "parallel": None,
55
56
  "local_files_only": False,
57
+ "model_kwargs": None,
56
58
  },
57
59
  }
58
60
 
@@ -78,6 +80,7 @@ class TestFastembedSparseTextEmbedder:
78
80
  "progress_bar": False,
79
81
  "parallel": 1,
80
82
  "local_files_only": True,
83
+ "model_kwargs": None,
81
84
  },
82
85
  }
83
86
 
@@ -134,7 +137,11 @@ class TestFastembedSparseTextEmbedder:
134
137
  mocked_factory.get_embedding_backend.assert_not_called()
135
138
  embedder.warm_up()
136
139
  mocked_factory.get_embedding_backend.assert_called_once_with(
137
- model_name="prithvida/Splade_PP_en_v1", cache_dir=None, threads=None, local_files_only=False
140
+ model_name="prithvida/Splade_PP_en_v1",
141
+ cache_dir=None,
142
+ threads=None,
143
+ local_files_only=False,
144
+ model_kwargs=None,
138
145
  )
139
146
 
140
147
  @patch(
@@ -194,6 +201,54 @@ class TestFastembedSparseTextEmbedder:
194
201
  with pytest.raises(TypeError, match="FastembedSparseTextEmbedder expects a string as input"):
195
202
  embedder.run(text=list_integers_input)
196
203
 
204
+ def test_init_with_model_kwargs_parameters(self):
205
+ """
206
+ Test initialization of FastembedSparseTextEmbedder with model_kwargs parameters.
207
+ """
208
+ bm25_config = {
209
+ "k": 1.2,
210
+ "b": 0.75,
211
+ "avg_len": 300.0,
212
+ "language": "english",
213
+ "token_max_length": 50,
214
+ }
215
+
216
+ embedder = FastembedSparseTextEmbedder(
217
+ model="Qdrant/bm25",
218
+ model_kwargs=bm25_config,
219
+ )
220
+
221
+ assert embedder.model_kwargs == bm25_config
222
+
223
+ @pytest.mark.integration
224
+ def test_run_with_model_kwargs(self):
225
+ """
226
+ Integration test to check the embedding with model_kwargs parameters.
227
+ """
228
+ bm25_config = {
229
+ "k": 1.2,
230
+ "b": 0.75,
231
+ "avg_len": 256.0,
232
+ }
233
+
234
+ embedder = FastembedSparseTextEmbedder(
235
+ model="Qdrant/bm25",
236
+ model_kwargs=bm25_config,
237
+ )
238
+ embedder.warm_up()
239
+
240
+ text = "Example content using BM25"
241
+
242
+ result = embedder.run(text=text)
243
+ embedding = result["sparse_embedding"]
244
+ embedding_dict = embedding.to_dict()
245
+
246
+ assert isinstance(embedding, SparseEmbedding)
247
+ assert isinstance(embedding_dict["indices"], list)
248
+ assert isinstance(embedding_dict["values"], list)
249
+ assert isinstance(embedding_dict["indices"][0], int)
250
+ assert isinstance(embedding_dict["values"][0], float)
251
+
197
252
  @pytest.mark.integration
198
253
  def test_run(self):
199
254
  embedder = FastembedSparseTextEmbedder(
@@ -3,6 +3,7 @@ from unittest.mock import MagicMock, patch
3
3
  import numpy as np
4
4
  import pytest
5
5
  from haystack import default_from_dict
6
+
6
7
  from haystack_integrations.components.embedders.fastembed.fastembed_text_embedder import (
7
8
  FastembedTextEmbedder,
8
9
  )