weaviate-haystack 6.2.0__tar.gz → 6.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 (27) hide show
  1. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/CHANGELOG.md +193 -181
  2. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/PKG-INFO +1 -1
  3. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/docker-compose.yml +2 -2
  4. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/document_stores/weaviate/document_store.py +49 -0
  5. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_document_store.py +39 -0
  6. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/.gitignore +0 -0
  7. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/LICENSE.txt +0 -0
  8. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/README.md +0 -0
  9. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/pydoc/config.yml +0 -0
  10. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/pyproject.toml +0 -0
  11. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/components/retrievers/py.typed +0 -0
  12. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/components/retrievers/weaviate/__init__.py +0 -0
  13. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/components/retrievers/weaviate/bm25_retriever.py +0 -0
  14. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/components/retrievers/weaviate/embedding_retriever.py +0 -0
  15. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/components/retrievers/weaviate/hybrid_retriever.py +0 -0
  16. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/document_stores/py.typed +0 -0
  17. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/document_stores/weaviate/__init__.py +0 -0
  18. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/document_stores/weaviate/_filters.py +0 -0
  19. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/src/haystack_integrations/document_stores/weaviate/auth.py +0 -0
  20. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/__init__.py +0 -0
  21. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/conftest.py +0 -0
  22. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_auth.py +0 -0
  23. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_bm25_retriever.py +0 -0
  24. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_embedding_retriever.py +0 -0
  25. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_files/robot1.jpg +0 -0
  26. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_filters.py +0 -0
  27. {weaviate_haystack-6.2.0 → weaviate_haystack-6.3.0}/tests/test_hybrid_retriever.py +0 -0
@@ -1,181 +1,193 @@
1
- # Changelog
2
-
3
- ## [integrations/weaviate-v6.1.0] - 2025-06-20
4
-
5
- ### 🐛 Bug Fixes
6
-
7
- - Weaviate - fix types + add py.typed (#1977)
8
-
9
-
10
- ### ⚙️ CI
11
-
12
- - Review testing workflows (#1541)
13
-
14
- ### 🧹 Chores
15
-
16
- - Align core-integrations Hatch scripts (#1898)
17
- - Update md files for new hatch scripts (#1911)
18
-
19
- ## [integrations/weaviate-v6.0.0] - 2025-03-11
20
-
21
-
22
- ### 🧹 Chores
23
-
24
- - Remove Python 3.8 support (#1421)
25
- - Weaviate - pin haystack and remove dataframe checks (#1521)
26
-
27
- ### 🌀 Miscellaneous
28
-
29
- - Docs: Update document store descriptions for deepset Pipeline Builder (#1447)
30
-
31
- ## [integrations/weaviate-v5.0.0] - 2025-02-17
32
-
33
- ### 🧹 Chores
34
-
35
- - Fix linting/isort (#1215)
36
- - Inherit from `FilterDocumentsTestWithDataframe` in Document Stores (#1290)
37
- - [**breaking**] Weaviate - remove dataframe support (#1406)
38
-
39
-
40
- ## [integrations/weaviate-v4.0.2] - 2024-11-13
41
-
42
- ### 🐛 Bug Fixes
43
-
44
- - Dependency for weaviate document store (#1186)
45
-
46
-
47
- ## [integrations/weaviate-v4.0.1] - 2024-11-11
48
-
49
- ### 🌀 Miscellaneous
50
-
51
- - Fix: Weaviate - skip `_split_overlap` meta field (#1173)
52
-
53
- ## [integrations/weaviate-v4.0.0] - 2024-10-18
54
-
55
- ### 🐛 Bug Fixes
56
-
57
- - Compatibility with Weaviate 4.9.0 (#1143)
58
-
59
- ### ⚙️ CI
60
-
61
- - Adopt uv as installer (#1142)
62
-
63
- ### 🧹 Chores
64
-
65
- - Weaviate - remove legacy filter support (#1070)
66
- - Update changelog after removing legacy filters (#1083)
67
- - Update ruff linting scripts and settings (#1105)
68
-
69
-
70
- ## [integrations/weaviate-v2.2.1] - 2024-09-07
71
-
72
- ### 🚀 Features
73
-
74
- - Add filter_policy to weaviate integration (#824)
75
-
76
- ### 🐛 Bug Fixes
77
-
78
- - Weaviate filter error (#811)
79
- - Fix connection to Weaviate Cloud Service (#624)
80
- - Pin weaviate-client (#1046)
81
- - Weaviate - fix connection issues with some WCS URLs (#1058)
82
-
83
- ### 🧪 Testing
84
-
85
- - Do not retry tests in `hatch run test` command (#954)
86
-
87
- ### ⚙️ CI
88
-
89
- - Retry tests to reduce flakyness (#836)
90
-
91
- ### 🧹 Chores
92
-
93
- - Update ruff invocation to include check parameter (#853)
94
-
95
- ### 🌀 Miscellaneous
96
-
97
- - Handle connection to WCS and add tests
98
- - Revert "Handle connection to WCS and add tests"
99
-
100
- This reverts commit f48802b2ce612896fd06a13cf33dffd9f77a8859.
101
- - Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845)
102
- - Chore: Minor retriever pydoc fix (#884)
103
- - Fix: `weaviate` - Fallback to default filter policy when deserializing retrievers without the init parameter (#903)
104
- - Fix: Weaviate: Use collections.list_all instead of collections._get_all (#921)
105
- - Chore: weaviate - ruff update, don't ruff tests (#986)
106
-
107
- ## [integrations/weaviate-v2.1.0] - 2024-06-10
108
-
109
- ### 🚀 Features
110
-
111
- - Defer the database connection to when it's needed (#802)
112
-
113
- ### 🐛 Bug Fixes
114
-
115
- - Weaviate schema class name conversion which preserves PascalCase (#707)
116
-
117
- ### 🌀 Miscellaneous
118
-
119
- - Chore: add license classifiers (#680)
120
- - Chore: change the pydoc renderer class (#718)
121
-
122
- ## [integrations/weaviate-v2.0.0] - 2024-03-25
123
-
124
- ### 📚 Documentation
125
-
126
- - Disable-class-def (#556)
127
- - Fix docstrings (#586)
128
-
129
- ### 🌀 Miscellaneous
130
-
131
- - Make tests show coverage (#566)
132
- - Migrate from weaviate python client v3 to v4 (#463)
133
- - Refactor tests (#574)
134
- - Remove references to Python 3.7 (#601)
135
- - Make Document Stores initially skip `SparseEmbedding` (#606)
136
- - Fix Weaviate retrievers returning no score (#621)
137
- - Update Weaviate docstrings (#622)
138
-
139
- ## [integrations/weaviate-v1.0.2] - 2024-02-27
140
-
141
- ### 🐛 Bug Fixes
142
-
143
- - Fix order of API docs (#447)
144
- - Weaviate: fix auth tests (#488)
145
-
146
- ### 📚 Documentation
147
-
148
- - Update category slug (#442)
149
-
150
- ### 🌀 Miscellaneous
151
-
152
- - Make retrievers return dicts (#491)
153
-
154
- ## [integrations/weaviate-v1.0.0] - 2024-02-15
155
-
156
- ### 🚀 Features
157
-
158
- - Generate weaviate API docs (#351)
159
-
160
- ### 🌀 Miscellaneous
161
-
162
- - WeaviateDocumentStore initialization and serialization (#187)
163
- - Move package under haystack_integrations (#214)
164
- - Add `collection_name` parameter and creation (#215)
165
- - Support more collection settings when creating a new `WeaviateDocumentStore` (#260)
166
- - Implement `count_document` for WeaviateDocumentStore (#267)
167
- - Add methods to convert from Document to Weaviate data object and viceversa (#269)
168
- - Add filter, write and delete documents in Weaviate (#270)
169
- - Implement filtering for `WeaviateDocumentStore` (#278)
170
- - Add `WeaviateBM25Retriever` (#410)
171
- - Add `WeaviateEmbeddingRetriever` (#412)
172
- - Update Weaviate docs configs (#414)
173
- - Update WeaviateDocumentStore authentication to use new Secret class (#425)
174
-
175
- ## [integrations/weaviate-v0.0.0] - 2024-01-10
176
-
177
- ### 🌀 Miscellaneous
178
-
179
- - Setup everything to start working on the Weaviate integration (#186)
180
-
181
- <!-- generated by git-cliff -->
1
+ # Changelog
2
+
3
+ ## [integrations/weaviate-v6.2.0] - 2025-09-18
4
+
5
+ ### 🚀 Features
6
+
7
+ - Weaviate Hybrid Retrieval (#2276)
8
+
9
+ ### 🧹 Chores
10
+
11
+ - Remove black (#1985)
12
+ - Standardize readmes - part 2 (#2205)
13
+
14
+
15
+ ## [integrations/weaviate-v6.1.0] - 2025-06-20
16
+
17
+ ### 🐛 Bug Fixes
18
+
19
+ - Weaviate - fix types + add py.typed (#1977)
20
+
21
+
22
+ ### ⚙️ CI
23
+
24
+ - Review testing workflows (#1541)
25
+
26
+ ### 🧹 Chores
27
+
28
+ - Align core-integrations Hatch scripts (#1898)
29
+ - Update md files for new hatch scripts (#1911)
30
+
31
+ ## [integrations/weaviate-v6.0.0] - 2025-03-11
32
+
33
+
34
+ ### 🧹 Chores
35
+
36
+ - Remove Python 3.8 support (#1421)
37
+ - Weaviate - pin haystack and remove dataframe checks (#1521)
38
+
39
+ ### 🌀 Miscellaneous
40
+
41
+ - Update document store descriptions (#1447)
42
+
43
+ ## [integrations/weaviate-v5.0.0] - 2025-02-17
44
+
45
+ ### 🧹 Chores
46
+
47
+ - Fix linting/isort (#1215)
48
+ - Inherit from `FilterDocumentsTestWithDataframe` in Document Stores (#1290)
49
+ - [**breaking**] Weaviate - remove dataframe support (#1406)
50
+
51
+
52
+ ## [integrations/weaviate-v4.0.2] - 2024-11-13
53
+
54
+ ### 🐛 Bug Fixes
55
+
56
+ - Dependency for weaviate document store (#1186)
57
+
58
+
59
+ ## [integrations/weaviate-v4.0.1] - 2024-11-11
60
+
61
+ ### 🌀 Miscellaneous
62
+
63
+ - Fix: Weaviate - skip `_split_overlap` meta field (#1173)
64
+
65
+ ## [integrations/weaviate-v4.0.0] - 2024-10-18
66
+
67
+ ### 🐛 Bug Fixes
68
+
69
+ - Compatibility with Weaviate 4.9.0 (#1143)
70
+
71
+ ### ⚙️ CI
72
+
73
+ - Adopt uv as installer (#1142)
74
+
75
+ ### 🧹 Chores
76
+
77
+ - Weaviate - remove legacy filter support (#1070)
78
+ - Update changelog after removing legacy filters (#1083)
79
+ - Update ruff linting scripts and settings (#1105)
80
+
81
+
82
+ ## [integrations/weaviate-v2.2.1] - 2024-09-07
83
+
84
+ ### 🚀 Features
85
+
86
+ - Add filter_policy to weaviate integration (#824)
87
+
88
+ ### 🐛 Bug Fixes
89
+
90
+ - Weaviate filter error (#811)
91
+ - Fix connection to Weaviate Cloud Service (#624)
92
+ - Pin weaviate-client (#1046)
93
+ - Weaviate - fix connection issues with some WCS URLs (#1058)
94
+
95
+ ### 🧪 Testing
96
+
97
+ - Do not retry tests in `hatch run test` command (#954)
98
+
99
+ ### ⚙️ CI
100
+
101
+ - Retry tests to reduce flakyness (#836)
102
+
103
+ ### 🧹 Chores
104
+
105
+ - Update ruff invocation to include check parameter (#853)
106
+
107
+ ### 🌀 Miscellaneous
108
+
109
+ - Handle connection to WCS and add tests
110
+ - Revert "Handle connection to WCS and add tests"
111
+
112
+ This reverts commit f48802b2ce612896fd06a13cf33dffd9f77a8859.
113
+ - Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845)
114
+ - Chore: Minor retriever pydoc fix (#884)
115
+ - Fix: `weaviate` - Fallback to default filter policy when deserializing retrievers without the init parameter (#903)
116
+ - Fix: Weaviate: Use collections.list_all instead of collections._get_all (#921)
117
+ - Chore: weaviate - ruff update, don't ruff tests (#986)
118
+
119
+ ## [integrations/weaviate-v2.1.0] - 2024-06-10
120
+
121
+ ### 🚀 Features
122
+
123
+ - Defer the database connection to when it's needed (#802)
124
+
125
+ ### 🐛 Bug Fixes
126
+
127
+ - Weaviate schema class name conversion which preserves PascalCase (#707)
128
+
129
+ ### 🌀 Miscellaneous
130
+
131
+ - Chore: add license classifiers (#680)
132
+ - Chore: change the pydoc renderer class (#718)
133
+
134
+ ## [integrations/weaviate-v2.0.0] - 2024-03-25
135
+
136
+ ### 📚 Documentation
137
+
138
+ - Disable-class-def (#556)
139
+ - Fix docstrings (#586)
140
+
141
+ ### 🌀 Miscellaneous
142
+
143
+ - Make tests show coverage (#566)
144
+ - Migrate from weaviate python client v3 to v4 (#463)
145
+ - Refactor tests (#574)
146
+ - Remove references to Python 3.7 (#601)
147
+ - Make Document Stores initially skip `SparseEmbedding` (#606)
148
+ - Fix Weaviate retrievers returning no score (#621)
149
+ - Update Weaviate docstrings (#622)
150
+
151
+ ## [integrations/weaviate-v1.0.2] - 2024-02-27
152
+
153
+ ### 🐛 Bug Fixes
154
+
155
+ - Fix order of API docs (#447)
156
+ - Weaviate: fix auth tests (#488)
157
+
158
+ ### 📚 Documentation
159
+
160
+ - Update category slug (#442)
161
+
162
+ ### 🌀 Miscellaneous
163
+
164
+ - Make retrievers return dicts (#491)
165
+
166
+ ## [integrations/weaviate-v1.0.0] - 2024-02-15
167
+
168
+ ### 🚀 Features
169
+
170
+ - Generate weaviate API docs (#351)
171
+
172
+ ### 🌀 Miscellaneous
173
+
174
+ - WeaviateDocumentStore initialization and serialization (#187)
175
+ - Move package under haystack_integrations (#214)
176
+ - Add `collection_name` parameter and creation (#215)
177
+ - Support more collection settings when creating a new `WeaviateDocumentStore` (#260)
178
+ - Implement `count_document` for WeaviateDocumentStore (#267)
179
+ - Add methods to convert from Document to Weaviate data object and viceversa (#269)
180
+ - Add filter, write and delete documents in Weaviate (#270)
181
+ - Implement filtering for `WeaviateDocumentStore` (#278)
182
+ - Add `WeaviateBM25Retriever` (#410)
183
+ - Add `WeaviateEmbeddingRetriever` (#412)
184
+ - Update Weaviate docs configs (#414)
185
+ - Update WeaviateDocumentStore authentication to use new Secret class (#425)
186
+
187
+ ## [integrations/weaviate-v0.0.0] - 2024-01-10
188
+
189
+ ### 🌀 Miscellaneous
190
+
191
+ - Setup everything to start working on the Weaviate integration (#186)
192
+
193
+ <!-- generated by git-cliff -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weaviate-haystack
3
- Version: 6.2.0
3
+ Version: 6.3.0
4
4
  Summary: An integration of Weaviate vector database with Haystack
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/weaviate/README.md
@@ -8,11 +8,11 @@ services:
8
8
  - '8080'
9
9
  - --scheme
10
10
  - http
11
- image: semitechnologies/weaviate:1.24.5
11
+ image: semitechnologies/weaviate:1.30.17
12
12
  ports:
13
13
  - 8080:8080
14
14
  - 50051:50051
15
- restart: on-failure:0
15
+ restart: 'no'
16
16
  environment:
17
17
  QUERY_DEFAULTS_LIMIT: 25
18
18
  AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
@@ -505,6 +505,55 @@ class WeaviateDocumentStore:
505
505
  weaviate_ids = [generate_uuid5(doc_id) for doc_id in document_ids]
506
506
  self.collection.data.delete_many(where=weaviate.classes.query.Filter.by_id().contains_any(weaviate_ids))
507
507
 
508
+ def delete_all_documents(self, *, recreate_index: bool = False, batch_size: int = 1000) -> None:
509
+ """
510
+ Deletes all documents in a collection.
511
+
512
+ If recreate_index is False, it keeps the collection but deletes documents iteratively.
513
+ If recreate_index is True, the collection is dropped and faithfully recreated.
514
+ This is recommended for performance reasons.
515
+
516
+ :param recreate_index: Use drop and recreate strategy. (recommended for performance)
517
+ :param batch_size: Only relevant if recreate_index is false. Defines the deletion batch size.
518
+ Note that this parameter needs to be less or equal to the set `QUERY_MAXIMUM_RESULTS` variable
519
+ set for the weaviate deployment (default is 10000).
520
+ Reference: https://docs.weaviate.io/weaviate/manage-objects/delete#delete-all-objects
521
+ """
522
+
523
+ if recreate_index:
524
+ # get current up-to-date config from server, so we can recreate the collection faithfully
525
+ cfg = self.client.collections.get(self._collection_settings["class"]).config.get().to_dict()
526
+ class_name = cfg.get("class", self._collection_settings["class"])
527
+
528
+ self.client.collections.delete(class_name)
529
+ self.client.collections.create_from_dict(cfg)
530
+
531
+ self._collection_settings = cfg
532
+ self._collection = self.client.collections.get(class_name)
533
+ return
534
+
535
+ uuids = []
536
+ batch_size = max(1, int(batch_size))
537
+
538
+ for obj in self.collection.iterator(return_properties=[], include_vector=False):
539
+ uuids.append(obj.uuid)
540
+ if len(uuids) >= batch_size:
541
+ res = self.collection.data.delete_many(where=weaviate.classes.query.Filter.by_id().contains_any(uuids))
542
+ if res.successful < len(uuids):
543
+ logger.warning(
544
+ "Not all documents in the batch have been deleted. "
545
+ "Make sure to specify a deletion `batch_size` which is less than `QUERY_MAXIMUM_RESULTS`.",
546
+ )
547
+ uuids.clear()
548
+
549
+ if uuids:
550
+ res = self.collection.data.delete_many(where=weaviate.classes.query.Filter.by_id().contains_any(uuids))
551
+ if res.successful < len(uuids):
552
+ logger.warning(
553
+ "Not all documents have been deleted. "
554
+ "Make sure to specify a deletion `batch_size` which is less than `QUERY_MAXIMUM_RESULTS`.",
555
+ )
556
+
508
557
  def _bm25_retrieval(
509
558
  self, query: str, filters: Optional[Dict[str, Any]] = None, top_k: Optional[int] = None
510
559
  ) -> List[Document]:
@@ -3,6 +3,7 @@
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
5
  import base64
6
+ import logging
6
7
  import os
7
8
  from typing import List
8
9
  from unittest.mock import MagicMock, patch
@@ -794,3 +795,41 @@ class TestWeaviateDocumentStore(CountDocumentsTest, WriteDocumentsTest, DeleteDo
794
795
  def test_connect_to_embedded(self):
795
796
  document_store = WeaviateDocumentStore(embedded_options=EmbeddedOptions())
796
797
  assert document_store.client
798
+
799
+ def test_delete_all_documents(self, document_store):
800
+ docs = [Document(content="test doc 1"), Document(content="test doc 2")]
801
+ assert document_store.write_documents(docs) == 2
802
+ assert document_store.count_documents() == 2
803
+ document_store.delete_all_documents()
804
+ assert document_store.count_documents() == 0
805
+
806
+ def test_delete_all_documents_recreate(self, document_store):
807
+ docs = [Document(content="test doc 1"), Document(content="test doc 2")]
808
+ assert document_store.write_documents(docs) == 2
809
+ assert document_store.count_documents() == 2
810
+
811
+ cls = document_store._collection_settings["class"]
812
+ collection = document_store.client.collections.get(cls)
813
+ previous_config = collection.config.get().to_dict()
814
+
815
+ document_store.delete_all_documents(recreate_index=True)
816
+ assert document_store.count_documents() == 0
817
+
818
+ new_config = document_store.client.collections.get(cls).config.get().to_dict()
819
+ assert previous_config == new_config
820
+
821
+ def test_delete_all_documents_batch_size(self, document_store):
822
+ docs = [Document(content=str(i)) for i in range(0, 5)]
823
+ assert document_store.write_documents(docs) == 5
824
+ document_store.delete_all_documents(batch_size=2)
825
+ assert document_store.count_documents() == 0
826
+
827
+ def test_delete_all_documents_excessive_batch_size(self, document_store, caplog):
828
+ """Test that the deletion is not complete if the batch size exceeds the QUERY_MAXIMUM_RESULTS."""
829
+ # assume QUERY_MAXIMUM_RESULTS == 10000 with standard deployment
830
+ docs = [Document(content=str(i)) for i in range(0, 10005)]
831
+ assert document_store.write_documents(docs) == 10005
832
+ with caplog.at_level(logging.WARNING):
833
+ document_store.delete_all_documents(batch_size=20000)
834
+ assert document_store.count_documents() == 5
835
+ assert "Not all documents have been deleted." in caplog.text