fastembed-haystack 2.2.0__tar.gz → 2.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.
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/CHANGELOG.md +20 -6
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/PKG-INFO +1 -1
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/rankers/fastembed/ranker.py +9 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_ranker.py +24 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/.gitignore +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/LICENSE.txt +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/README.md +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/examples/example.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/examples/ranker_example.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/examples/sparse_example.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/pydoc/config_docusaurus.yml +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/pyproject.toml +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/__init__.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/embedding_backend/__init__.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/embedding_backend/fastembed_backend.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_document_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_sparse_document_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_sparse_text_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/fastembed/fastembed_text_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/embedders/py.typed +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/rankers/fastembed/__init__.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/rankers/fastembed/late_interaction_ranker.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/src/haystack_integrations/components/rankers/py.typed +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/__init__.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_backend.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_document_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_late_interaction_ranker.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_sparse_document_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_sparse_text_embedder.py +0 -0
- {fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_text_embedder.py +0 -0
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [integrations/fastembed-v2.
|
|
3
|
+
## [integrations/fastembed-v2.2.0] - 2026-04-16
|
|
4
|
+
|
|
5
|
+
### 🚀 Features
|
|
6
|
+
|
|
7
|
+
- Update `FastembedRanker` to auto call `warm_up` on first run (#2834)
|
|
8
|
+
- Add FastembedLateInteractionRanker for ColBERT late-interaction reranking (#3135)
|
|
9
|
+
|
|
10
|
+
### 🐛 Bug Fixes
|
|
11
|
+
|
|
12
|
+
- Replace in-place dataclass mutations with dataclasses.replace() (#3112)
|
|
4
13
|
|
|
5
14
|
### 📚 Documentation
|
|
6
15
|
|
|
7
16
|
- *(fastembed)* Remove explicit warm_up from examples (#2830)
|
|
17
|
+
- Simplify pydoc configs (#2855)
|
|
18
|
+
|
|
19
|
+
### 🧪 Testing
|
|
20
|
+
|
|
21
|
+
- Track test coverage for all integrations (#3065)
|
|
22
|
+
|
|
23
|
+
### 🧹 Chores
|
|
24
|
+
|
|
25
|
+
- Add ANN type annotations to faiss, fastembed, firecrawl, github, google_ai (#2988)
|
|
26
|
+
- Enforce ruff docstring rules (D102/D103/D205/D209/D213/D417/D419) in integrations 11-20 (#3009)
|
|
8
27
|
|
|
9
28
|
### 🌀 Miscellaneous
|
|
10
29
|
|
|
11
|
-
- Automatically call warm_up() if model is not loaded in FastembedRanker
|
|
12
|
-
- Remove explicit call to warm_up() in ranker_example.py
|
|
13
|
-
- Add unit tests
|
|
14
30
|
- Fix typing issue
|
|
15
31
|
- Fix tying
|
|
16
|
-
- Update docstrings
|
|
17
|
-
- Remove explicit warm_up calls from integration tests
|
|
18
32
|
|
|
19
33
|
## [integrations/fastembed-v2.0.0] - 2026-01-12
|
|
20
34
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastembed-haystack
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.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
|
|
@@ -48,6 +48,7 @@ class FastembedRanker:
|
|
|
48
48
|
local_files_only: bool = False,
|
|
49
49
|
meta_fields_to_embed: list[str] | None = None,
|
|
50
50
|
meta_data_separator: str = "\n",
|
|
51
|
+
score_threshold: float | None = None,
|
|
51
52
|
) -> None:
|
|
52
53
|
"""
|
|
53
54
|
Creates an instance of the 'FastembedRanker'.
|
|
@@ -68,6 +69,8 @@ class FastembedRanker:
|
|
|
68
69
|
with the document content for reranking.
|
|
69
70
|
:param meta_data_separator: Separator used to concatenate the meta fields
|
|
70
71
|
to the Document content.
|
|
72
|
+
:param score_threshold: If provided, only documents with a score above the threshold are returned.
|
|
73
|
+
Applied after `top_k`, so the output may contain fewer than `top_k` documents.
|
|
71
74
|
"""
|
|
72
75
|
if top_k <= 0:
|
|
73
76
|
msg = f"top_k must be > 0, but got {top_k}"
|
|
@@ -82,6 +85,7 @@ class FastembedRanker:
|
|
|
82
85
|
self.local_files_only = local_files_only
|
|
83
86
|
self.meta_fields_to_embed = meta_fields_to_embed or []
|
|
84
87
|
self.meta_data_separator = meta_data_separator
|
|
88
|
+
self.score_threshold = score_threshold
|
|
85
89
|
self._model: TextCrossEncoder | None = None
|
|
86
90
|
|
|
87
91
|
def to_dict(self) -> dict[str, Any]:
|
|
@@ -102,6 +106,7 @@ class FastembedRanker:
|
|
|
102
106
|
local_files_only=self.local_files_only,
|
|
103
107
|
meta_fields_to_embed=self.meta_fields_to_embed,
|
|
104
108
|
meta_data_separator=self.meta_data_separator,
|
|
109
|
+
score_threshold=self.score_threshold,
|
|
105
110
|
)
|
|
106
111
|
|
|
107
112
|
@classmethod
|
|
@@ -201,4 +206,8 @@ class FastembedRanker:
|
|
|
201
206
|
|
|
202
207
|
top_k_documents = [replace(doc, score=score) for doc, score in sorted_doc_scores[:top_k]]
|
|
203
208
|
|
|
209
|
+
score_threshold = self.score_threshold
|
|
210
|
+
if score_threshold is not None:
|
|
211
|
+
top_k_documents = [doc for doc in top_k_documents if doc.score is not None and doc.score >= score_threshold]
|
|
212
|
+
|
|
204
213
|
return {"documents": top_k_documents}
|
|
@@ -28,6 +28,7 @@ class TestFastembedRanker:
|
|
|
28
28
|
assert not ranker.local_files_only
|
|
29
29
|
assert ranker.meta_fields_to_embed == []
|
|
30
30
|
assert ranker.meta_data_separator == "\n"
|
|
31
|
+
assert ranker.score_threshold is None
|
|
31
32
|
|
|
32
33
|
def test_init_with_parameters(self):
|
|
33
34
|
"""
|
|
@@ -43,6 +44,7 @@ class TestFastembedRanker:
|
|
|
43
44
|
local_files_only=True,
|
|
44
45
|
meta_fields_to_embed=["test_field"],
|
|
45
46
|
meta_data_separator=" | ",
|
|
47
|
+
score_threshold=0.5,
|
|
46
48
|
)
|
|
47
49
|
assert ranker.model_name == "BAAI/bge-reranker-base"
|
|
48
50
|
assert ranker.top_k == 64
|
|
@@ -53,6 +55,7 @@ class TestFastembedRanker:
|
|
|
53
55
|
assert ranker.local_files_only
|
|
54
56
|
assert ranker.meta_fields_to_embed == ["test_field"]
|
|
55
57
|
assert ranker.meta_data_separator == " | "
|
|
58
|
+
assert ranker.score_threshold == 0.5
|
|
56
59
|
|
|
57
60
|
def test_init_with_incorrect_input(self):
|
|
58
61
|
"""
|
|
@@ -88,6 +91,7 @@ class TestFastembedRanker:
|
|
|
88
91
|
"local_files_only": False,
|
|
89
92
|
"meta_fields_to_embed": [],
|
|
90
93
|
"meta_data_separator": "\n",
|
|
94
|
+
"score_threshold": None,
|
|
91
95
|
},
|
|
92
96
|
}
|
|
93
97
|
|
|
@@ -105,6 +109,7 @@ class TestFastembedRanker:
|
|
|
105
109
|
local_files_only=True,
|
|
106
110
|
meta_fields_to_embed=["test_field"],
|
|
107
111
|
meta_data_separator=" | ",
|
|
112
|
+
score_threshold=0.5,
|
|
108
113
|
)
|
|
109
114
|
ranker_dict = ranker.to_dict()
|
|
110
115
|
assert ranker_dict == {
|
|
@@ -119,6 +124,7 @@ class TestFastembedRanker:
|
|
|
119
124
|
"local_files_only": True,
|
|
120
125
|
"meta_fields_to_embed": ["test_field"],
|
|
121
126
|
"meta_data_separator": " | ",
|
|
127
|
+
"score_threshold": 0.5,
|
|
122
128
|
},
|
|
123
129
|
}
|
|
124
130
|
|
|
@@ -138,6 +144,7 @@ class TestFastembedRanker:
|
|
|
138
144
|
"local_files_only": False,
|
|
139
145
|
"meta_fields_to_embed": [],
|
|
140
146
|
"meta_data_separator": "\n",
|
|
147
|
+
"score_threshold": None,
|
|
141
148
|
},
|
|
142
149
|
}
|
|
143
150
|
ranker = default_from_dict(FastembedRanker, ranker_dict)
|
|
@@ -150,6 +157,7 @@ class TestFastembedRanker:
|
|
|
150
157
|
assert not ranker.local_files_only
|
|
151
158
|
assert ranker.meta_fields_to_embed == []
|
|
152
159
|
assert ranker.meta_data_separator == "\n"
|
|
160
|
+
assert ranker.score_threshold is None
|
|
153
161
|
|
|
154
162
|
def test_from_dict_with_custom_init_parameters(self):
|
|
155
163
|
"""
|
|
@@ -167,6 +175,7 @@ class TestFastembedRanker:
|
|
|
167
175
|
"local_files_only": True,
|
|
168
176
|
"meta_fields_to_embed": ["test_field"],
|
|
169
177
|
"meta_data_separator": " | ",
|
|
178
|
+
"score_threshold": 0.5,
|
|
170
179
|
},
|
|
171
180
|
}
|
|
172
181
|
ranker = default_from_dict(FastembedRanker, ranker_dict)
|
|
@@ -179,6 +188,7 @@ class TestFastembedRanker:
|
|
|
179
188
|
assert ranker.local_files_only
|
|
180
189
|
assert ranker.meta_fields_to_embed == ["test_field"]
|
|
181
190
|
assert ranker.meta_data_separator == " | "
|
|
191
|
+
assert ranker.score_threshold == 0.5
|
|
182
192
|
|
|
183
193
|
def test_run_incorrect_input_format(self):
|
|
184
194
|
"""
|
|
@@ -257,6 +267,20 @@ class TestFastembedRanker:
|
|
|
257
267
|
parallel=None,
|
|
258
268
|
)
|
|
259
269
|
|
|
270
|
+
def test_run_with_score_threshold(self):
|
|
271
|
+
"""
|
|
272
|
+
Tests that documents below score_threshold are filtered out.
|
|
273
|
+
"""
|
|
274
|
+
ranker = FastembedRanker(model_name="model_name", score_threshold=0.5)
|
|
275
|
+
ranker._model = MagicMock()
|
|
276
|
+
ranker._model.rerank.return_value = [0.9, 0.3, 0.7]
|
|
277
|
+
|
|
278
|
+
documents = [Document(content=f"doc {i}") for i in range(3)]
|
|
279
|
+
result = ranker.run(query="test", documents=documents)
|
|
280
|
+
|
|
281
|
+
assert len(result["documents"]) == 2
|
|
282
|
+
assert all(doc.score >= 0.5 for doc in result["documents"])
|
|
283
|
+
|
|
260
284
|
def test_run_calls_warm_up(self):
|
|
261
285
|
"""
|
|
262
286
|
Unit test to check that warm_up is called when run is called for the first time.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_document_embedder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastembed_haystack-2.2.0 → fastembed_haystack-2.3.0}/tests/test_fastembed_sparse_text_embedder.py
RENAMED
|
File without changes
|
|
File without changes
|