faiss-haystack 3.1.1__tar.gz → 3.2.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.
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [integrations/faiss-v3.1.1] - 2026-11-30
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - *(faiss)* Raise on repeated IDs within a batch under DuplicatePolicy.FAIL (#4332)
8
+ - *(faiss)* [**breaking**] Score closer documents higher for all index types (#4342)
9
+
10
+
3
11
  ## [integrations/faiss-v3.1.0] - 2026-11-27
4
12
 
5
13
  ### 🐛 Bug Fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: faiss-haystack
3
- Version: 3.1.1
3
+ Version: 3.2.0
4
4
  Summary: An integration of FAISS (library for efficient similarity search of dense vectors) with Haystack
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/faiss#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -128,7 +128,10 @@ class FAISSEmbeddingRetriever:
128
128
  - `documents`: List of `Document`s that are similar to `query_embedding`.
129
129
  """
130
130
  filters = apply_filter_policy(self.filter_policy, self.filters, filters)
131
- top_k = top_k or self.top_k
131
+ if top_k is None:
132
+ top_k = self.top_k
133
+ if top_k == 0:
134
+ return {"documents": []}
132
135
  docs = self.document_store.search(query_embedding=query_embedding, top_k=top_k, filters=filters)
133
136
  return {"documents": docs}
134
137
 
@@ -36,6 +36,15 @@ def test_invalid_document_store_type():
36
36
  FAISSEmbeddingRetriever(document_store="not_a_store") # type: ignore[arg-type]
37
37
 
38
38
 
39
+ def test_run_with_top_k_zero_returns_no_documents(populated_store):
40
+ """``top_k=0`` asks for no documents; it must not fall back to the init default."""
41
+ retriever = FAISSEmbeddingRetriever(document_store=populated_store, top_k=10)
42
+
43
+ result = retriever.run(query_embedding=[1.0, 0.0, 0.0], top_k=0)
44
+
45
+ assert result == {"documents": []}
46
+
47
+
39
48
  @pytest.mark.integration
40
49
  class TestFAISSEmbeddingRetriever:
41
50
  def test_run_with_query_embedding_only(self, populated_store):
File without changes