weaviate-haystack 2.2.0__tar.gz → 3.0.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 (23) hide show
  1. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/CHANGELOG.md +7 -1
  2. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/PKG-INFO +2 -2
  3. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/pyproject.toml +7 -5
  4. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/components/retrievers/weaviate/bm25_retriever.py +1 -0
  5. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/components/retrievers/weaviate/embedding_retriever.py +1 -0
  6. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/document_stores/weaviate/document_store.py +9 -8
  7. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/test_auth.py +5 -4
  8. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/test_bm25_retriever.py +1 -0
  9. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/test_document_store.py +6 -14
  10. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/test_embedding_retriever.py +1 -0
  11. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/.gitignore +0 -0
  12. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/LICENSE.txt +0 -0
  13. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/README.md +0 -0
  14. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/docker-compose.yml +0 -0
  15. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/pydoc/config.yml +0 -0
  16. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/components/retrievers/weaviate/__init__.py +0 -0
  17. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/document_stores/weaviate/__init__.py +0 -0
  18. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/document_stores/weaviate/_filters.py +0 -0
  19. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/src/haystack_integrations/document_stores/weaviate/auth.py +0 -0
  20. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/__init__.py +0 -0
  21. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/conftest.py +0 -0
  22. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/test_files/robot1.jpg +0 -0
  23. {weaviate_haystack-2.2.0 → weaviate_haystack-3.0.0}/tests/test_filters.py +0 -0
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## [unreleased]
3
+ ## [integrations/weaviate-v2.2.1] - 2024-09-07
4
4
 
5
5
  ### 🚀 Features
6
6
 
@@ -10,6 +10,12 @@
10
10
 
11
11
  - Weaviate filter error (#811)
12
12
  - Fix connection to Weaviate Cloud Service (#624)
13
+ - Pin weaviate-client (#1046)
14
+ - Weaviate - fix connection issues with some WCS URLs (#1058)
15
+
16
+ ### 🧪 Testing
17
+
18
+ - Do not retry tests in `hatch run test` command (#954)
13
19
 
14
20
  ### ⚙️ Miscellaneous Tasks
15
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: weaviate-haystack
3
- Version: 2.2.0
3
+ Version: 3.0.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
@@ -22,7 +22,7 @@ Requires-Python: >=3.8
22
22
  Requires-Dist: haystack-ai
23
23
  Requires-Dist: haystack-pydoc-tools
24
24
  Requires-Dist: python-dateutil
25
- Requires-Dist: weaviate-client
25
+ Requires-Dist: weaviate-client>=4.0
26
26
  Description-Content-Type: text/markdown
27
27
 
28
28
  # weaviate-haystack
@@ -25,7 +25,7 @@ classifiers = [
25
25
  ]
26
26
  dependencies = [
27
27
  "haystack-ai",
28
- "weaviate-client",
28
+ "weaviate-client>=4.0",
29
29
  "haystack-pydoc-tools",
30
30
  "python-dateutil",
31
31
  ]
@@ -49,10 +49,12 @@ git_describe_command = 'git describe --tags --match="integrations/weaviate-v[0-9
49
49
  [tool.hatch.envs.default]
50
50
  dependencies = ["coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", "ipython"]
51
51
  [tool.hatch.envs.default.scripts]
52
- test = "pytest --reruns 3 --reruns-delay 30 -x {args:tests}"
53
- test-cov = "coverage run -m pytest --reruns 3 --reruns-delay 30 -x {args:tests}"
52
+ test = "pytest {args:tests}"
53
+ test-cov = "coverage run -m pytest {args:tests}"
54
+ test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x"
54
55
  cov-report = ["- coverage combine", "coverage report"]
55
56
  cov = ["test-cov", "cov-report"]
57
+ cov-retry = ["test-cov-retry", "cov-report"]
56
58
  docs = ["pydoc-markdown pydoc/config.yml"]
57
59
 
58
60
  [[tool.hatch.envs.all.matrix]]
@@ -63,8 +65,8 @@ detached = true
63
65
  dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
64
66
  [tool.hatch.envs.lint.scripts]
65
67
  typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
66
- style = ["ruff check {args:.}", "black --check --diff {args:.}"]
67
- fmt = ["black {args:.}", "ruff --fix {args:.}", "style"]
68
+ style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
69
+ fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"]
68
70
  all = ["style", "typing"]
69
71
 
70
72
  [tool.black]
@@ -7,6 +7,7 @@ from typing import Any, Dict, List, Optional, Union
7
7
  from haystack import Document, component, default_from_dict, default_to_dict
8
8
  from haystack.document_stores.types import FilterPolicy
9
9
  from haystack.document_stores.types.filter_policy import apply_filter_policy
10
+
10
11
  from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore
11
12
 
12
13
 
@@ -7,6 +7,7 @@ from typing import Any, Dict, List, Optional, Union
7
7
  from haystack import Document, component, default_from_dict, default_to_dict
8
8
  from haystack.document_stores.types import FilterPolicy
9
9
  from haystack.document_stores.types.filter_policy import apply_filter_policy
10
+
10
11
  from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore
11
12
 
12
13
 
@@ -12,7 +12,6 @@ from haystack.core.serialization import default_from_dict, default_to_dict
12
12
  from haystack.dataclasses.document import Document
13
13
  from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
14
14
  from haystack.document_stores.types.policy import DuplicatePolicy
15
- from haystack.utils.filters import convert
16
15
 
17
16
  import weaviate
18
17
  from weaviate.collections.classes.data import DataObject
@@ -68,7 +67,7 @@ class WeaviateDocumentStore:
68
67
  from haystack_integrations.document_stores.weaviate.auth import AuthApiKey
69
68
  from haystack_integrations.document_stores.weaviate.document_store import WeaviateDocumentStore
70
69
 
71
- os.environ["WEAVIATE_API_KEY"] = "MY_API_KEY
70
+ os.environ["WEAVIATE_API_KEY"] = "MY_API_KEY"
72
71
 
73
72
  document_store = WeaviateDocumentStore(
74
73
  url="rAnD0mD1g1t5.something.weaviate.cloud",
@@ -172,17 +171,18 @@ class WeaviateDocumentStore:
172
171
  if self._client:
173
172
  return self._client
174
173
 
175
- if self._url and self._url.startswith("http") and self._url.endswith(".weaviate.network"):
176
- # We use this utility function instead of using WeaviateClient directly like in other cases
177
- # otherwise we'd have to parse the URL to get some information about the connection.
178
- # This utility function does all that for us.
179
- self._client = weaviate.connect_to_wcs(
174
+ if self._url and self._url.endswith((".weaviate.network", ".weaviate.cloud")):
175
+ # If we detect that the URL is a Weaviate Cloud URL, we use the utility function to connect
176
+ # instead of using WeaviateClient directly like in other cases.
177
+ # Among other things, the utility function takes care of parsing the URL.
178
+ self._client = weaviate.connect_to_weaviate_cloud(
180
179
  self._url,
181
180
  auth_credentials=self._auth_client_secret.resolve_value() if self._auth_client_secret else None,
182
181
  headers=self._additional_headers,
183
182
  additional_config=self._additional_config,
184
183
  )
185
184
  else:
185
+ # Embedded, local Docker deployment or custom connection.
186
186
  # proxies, timeout_config, trust_env are part of additional_config now
187
187
  # startup_period has been removed
188
188
  self._client = weaviate.WeaviateClient(
@@ -387,7 +387,8 @@ class WeaviateDocumentStore:
387
387
  :returns: A list of Documents that match the given filters.
388
388
  """
389
389
  if filters and "operator" not in filters and "conditions" not in filters:
390
- filters = convert(filters)
390
+ msg = "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details."
391
+ raise ValueError(msg)
391
392
 
392
393
  result = []
393
394
  if filters:
@@ -2,6 +2,11 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ from weaviate.auth import AuthApiKey as WeaviateAuthApiKey
6
+ from weaviate.auth import AuthBearerToken as WeaviateAuthBearerToken
7
+ from weaviate.auth import AuthClientCredentials as WeaviateAuthClientCredentials
8
+ from weaviate.auth import AuthClientPassword as WeaviateAuthClientPassword
9
+
5
10
  from haystack_integrations.document_stores.weaviate.auth import (
6
11
  AuthApiKey,
7
12
  AuthBearerToken,
@@ -9,10 +14,6 @@ from haystack_integrations.document_stores.weaviate.auth import (
9
14
  AuthClientPassword,
10
15
  AuthCredentials,
11
16
  )
12
- from weaviate.auth import AuthApiKey as WeaviateAuthApiKey
13
- from weaviate.auth import AuthBearerToken as WeaviateAuthBearerToken
14
- from weaviate.auth import AuthClientCredentials as WeaviateAuthClientCredentials
15
- from weaviate.auth import AuthClientPassword as WeaviateAuthClientPassword
16
17
 
17
18
 
18
19
  class TestAuthApiKey:
@@ -6,6 +6,7 @@ from unittest.mock import Mock, patch
6
6
 
7
7
  import pytest
8
8
  from haystack.document_stores.types import FilterPolicy
9
+
9
10
  from haystack_integrations.components.retrievers.weaviate import WeaviateBM25Retriever
10
11
  from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore
11
12
 
@@ -22,11 +22,6 @@ from haystack.testing.document_store import (
22
22
  WriteDocumentsTest,
23
23
  )
24
24
  from haystack.utils.auth import Secret
25
- from haystack_integrations.document_stores.weaviate.auth import AuthApiKey
26
- from haystack_integrations.document_stores.weaviate.document_store import (
27
- DOCUMENT_COLLECTION_PROPERTIES,
28
- WeaviateDocumentStore,
29
- )
30
25
  from numpy import array as np_array
31
26
  from numpy import array_equal as np_array_equal
32
27
  from numpy import float32 as np_float32
@@ -41,6 +36,12 @@ from weaviate.embedded import (
41
36
  EmbeddedOptions,
42
37
  )
43
38
 
39
+ from haystack_integrations.document_stores.weaviate.auth import AuthApiKey
40
+ from haystack_integrations.document_stores.weaviate.document_store import (
41
+ DOCUMENT_COLLECTION_PROPERTIES,
42
+ WeaviateDocumentStore,
43
+ )
44
+
44
45
 
45
46
  @patch("haystack_integrations.document_stores.weaviate.document_store.weaviate.WeaviateClient")
46
47
  def test_init_is_lazy(_mock_client):
@@ -659,15 +660,6 @@ class TestWeaviateDocumentStore(CountDocumentsTest, WriteDocumentsTest, DeleteDo
659
660
  with pytest.raises(ValueError):
660
661
  document_store._embedding_retrieval(query_embedding=[], distance=0.1, certainty=0.1)
661
662
 
662
- def test_filter_documents_with_legacy_filters(self, document_store):
663
- docs = []
664
- for index in range(10):
665
- docs.append(Document(content="This is some content", meta={"index": index}))
666
- document_store.write_documents(docs)
667
- result = document_store.filter_documents({"content": {"$eq": "This is some content"}})
668
-
669
- assert len(result) == 10
670
-
671
663
  def test_filter_documents_below_default_limit(self, document_store):
672
664
  docs = []
673
665
  for index in range(9998):
@@ -6,6 +6,7 @@ from unittest.mock import Mock, patch
6
6
 
7
7
  import pytest
8
8
  from haystack.document_stores.types import FilterPolicy
9
+
9
10
  from haystack_integrations.components.retrievers.weaviate import WeaviateEmbeddingRetriever
10
11
  from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore
11
12