chroma-haystack 3.2.0__tar.gz → 3.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 (58) hide show
  1. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/CHANGELOG.md +13 -1
  2. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/PKG-INFO +1 -1
  3. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/pyproject.toml +7 -5
  4. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/components/retrievers/chroma/retriever.py +6 -6
  5. chroma_haystack-3.3.0/src/haystack_integrations/components/retrievers/py.typed +0 -0
  6. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/document_stores/chroma/document_store.py +7 -6
  7. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/document_stores/chroma/utils.py +3 -1
  8. chroma_haystack-3.3.0/src/haystack_integrations/document_stores/py.typed +0 -0
  9. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/.gitignore +0 -0
  10. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/LICENSE +0 -0
  11. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/README.md +0 -0
  12. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_01.txt +0 -0
  13. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_02.txt +0 -0
  14. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_03.txt +0 -0
  15. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_04.txt +0 -0
  16. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_05.txt +0 -0
  17. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_06.txt +0 -0
  18. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_07.txt +0 -0
  19. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_08.txt +0 -0
  20. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_09.txt +0 -0
  21. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_10.txt +0 -0
  22. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_11.txt +0 -0
  23. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_12.txt +0 -0
  24. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_20.txt +0 -0
  25. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_21.txt +0 -0
  26. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_22.txt +0 -0
  27. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_23.txt +0 -0
  28. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_24.txt +0 -0
  29. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_25.txt +0 -0
  30. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_26.txt +0 -0
  31. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_27.txt +0 -0
  32. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_28.txt +0 -0
  33. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_29.txt +0 -0
  34. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_30.txt +0 -0
  35. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_31.txt +0 -0
  36. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_32.txt +0 -0
  37. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_40.txt +0 -0
  38. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_41.txt +0 -0
  39. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_42.txt +0 -0
  40. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_43.txt +0 -0
  41. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_44.txt +0 -0
  42. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_45.txt +0 -0
  43. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_46.txt +0 -0
  44. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_50.txt +0 -0
  45. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_51.txt +0 -0
  46. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_52.txt +0 -0
  47. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/data/usr_90.txt +0 -0
  48. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/example/example.py +0 -0
  49. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/pydoc/config.yml +0 -0
  50. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/components/retrievers/chroma/__init__.py +0 -0
  51. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/document_stores/chroma/__init__.py +0 -0
  52. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/document_stores/chroma/errors.py +0 -0
  53. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/src/haystack_integrations/document_stores/chroma/filters.py +0 -0
  54. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/tests/__init__.py +0 -0
  55. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/tests/conftest.py +0 -0
  56. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/tests/test_document_store.py +0 -0
  57. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/tests/test_document_store_async.py +0 -0
  58. {chroma_haystack-3.2.0 → chroma_haystack-3.3.0}/tests/test_retriever.py +0 -0
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- ## [integrations/chroma-v3.1.0] - 2025-04-14
3
+ ## [integrations/chroma-v3.2.0] - 2025-06-06
4
+
5
+ ### 🚀 Features
6
+
7
+ - Add async support for Chroma + improve typing (#1697)
8
+
9
+
10
+ ### 🧹 Chores
11
+
12
+ - Align core-integrations Hatch scripts (#1898)
13
+
14
+
15
+ ## [integrations/chroma-v2.0.3] - 2025-04-04
4
16
 
5
17
  ### 🐛 Bug Fixes
6
18
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chroma-haystack
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/chroma#readme
5
5
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
6
6
  Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/chroma
@@ -66,7 +66,13 @@ integration = 'pytest -m "integration" {args:tests}'
66
66
  all = 'pytest {args:tests}'
67
67
  cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x'
68
68
 
69
- types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
69
+ types = "mypy -p haystack_integrations.components.retrievers.chroma -p haystack_integrations.document_stores.chroma {args}"
70
+
71
+ [tool.mypy]
72
+ install_types = true
73
+ non_interactive = true
74
+ check_untyped_defs = true
75
+ disallow_incomplete_defs = true
70
76
 
71
77
  [tool.hatch.metadata]
72
78
  allow-direct-references = true
@@ -160,7 +166,3 @@ exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
160
166
  [tool.pytest.ini_options]
161
167
  minversion = "6.0"
162
168
  markers = ["integration: integration tests"]
163
-
164
- [[tool.mypy.overrides]]
165
- module = ["haystack_integrations.*"]
166
- ignore_missing_imports = true
@@ -71,7 +71,7 @@ class ChromaQueryTextRetriever:
71
71
  query: str,
72
72
  filters: Optional[Dict[str, Any]] = None,
73
73
  top_k: Optional[int] = None,
74
- ):
74
+ ) -> Dict[str, Any]:
75
75
  """
76
76
  Run the retriever on the given input data.
77
77
 
@@ -96,7 +96,7 @@ class ChromaQueryTextRetriever:
96
96
  query: str,
97
97
  filters: Optional[Dict[str, Any]] = None,
98
98
  top_k: Optional[int] = None,
99
- ):
99
+ ) -> Dict[str, Any]:
100
100
  """
101
101
  Asynchronously run the retriever on the given input data.
102
102
 
@@ -115,7 +115,7 @@ class ChromaQueryTextRetriever:
115
115
  """
116
116
  filters = apply_filter_policy(self.filter_policy, self.filters, filters)
117
117
  top_k = top_k or self.top_k
118
- return {"documents": await self.document_store.search_async([query], top_k, filters)[0]}
118
+ return {"documents": (await self.document_store.search_async([query], top_k, filters))[0]}
119
119
 
120
120
  @classmethod
121
121
  def from_dict(cls, data: Dict[str, Any]) -> "ChromaQueryTextRetriever":
@@ -184,7 +184,7 @@ class ChromaEmbeddingRetriever:
184
184
  query_embedding: List[float],
185
185
  filters: Optional[Dict[str, Any]] = None,
186
186
  top_k: Optional[int] = None,
187
- ):
187
+ ) -> Dict[str, Any]:
188
188
  """
189
189
  Run the retriever on the given input data.
190
190
 
@@ -211,7 +211,7 @@ class ChromaEmbeddingRetriever:
211
211
  query_embedding: List[float],
212
212
  filters: Optional[Dict[str, Any]] = None,
213
213
  top_k: Optional[int] = None,
214
- ):
214
+ ) -> Dict[str, Any]:
215
215
  """
216
216
  Asynchronously run the retriever on the given input data.
217
217
 
@@ -232,7 +232,7 @@ class ChromaEmbeddingRetriever:
232
232
  top_k = top_k or self.top_k
233
233
 
234
234
  query_embeddings = [query_embedding]
235
- return {"documents": await self.document_store.search_embeddings_async(query_embeddings, top_k, filters)[0]}
235
+ return {"documents": (await self.document_store.search_embeddings_async(query_embeddings, top_k, filters))[0]}
236
236
 
237
237
  @classmethod
238
238
  def from_dict(cls, data: Dict[str, Any]) -> "ChromaEmbeddingRetriever":
@@ -2,9 +2,10 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- from typing import Any, Dict, List, Literal, Optional
5
+ from typing import Any, Dict, List, Literal, Optional, Sequence, cast
6
6
 
7
7
  import chromadb
8
+ from chromadb.api.models.AsyncCollection import AsyncCollection
8
9
  from chromadb.api.types import GetResult, QueryResult
9
10
  from haystack import default_from_dict, default_to_dict, logging
10
11
  from haystack.dataclasses import Document
@@ -37,7 +38,7 @@ class ChromaDocumentStore:
37
38
  port: Optional[int] = None,
38
39
  distance_function: Literal["l2", "cosine", "ip"] = "l2",
39
40
  metadata: Optional[dict] = None,
40
- **embedding_function_params,
41
+ **embedding_function_params: Any,
41
42
  ):
42
43
  """
43
44
  Creates a new ChromaDocumentStore instance.
@@ -86,8 +87,8 @@ class ChromaDocumentStore:
86
87
  self._host = host
87
88
  self._port = port
88
89
 
89
- self._collection = None
90
- self._async_collection = None
90
+ self._collection: Optional[chromadb.Collection] = None
91
+ self._async_collection: Optional[AsyncCollection] = None
91
92
 
92
93
  def _ensure_initialized(self):
93
94
  if not self._collection:
@@ -482,7 +483,7 @@ class ChromaDocumentStore:
482
483
 
483
484
  kwargs = self._prepare_query_kwargs(filters)
484
485
  results = self._collection.query(
485
- query_embeddings=query_embeddings,
486
+ query_embeddings=cast(List[Sequence[float]], query_embeddings),
486
487
  n_results=top_k,
487
488
  **kwargs,
488
489
  )
@@ -513,7 +514,7 @@ class ChromaDocumentStore:
513
514
 
514
515
  kwargs = self._prepare_query_kwargs(filters)
515
516
  results = await self._async_collection.query(
516
- query_embeddings=query_embeddings,
517
+ query_embeddings=cast(List[Sequence[float]], query_embeddings),
517
518
  n_results=top_k,
518
519
  **kwargs,
519
520
  )
@@ -2,6 +2,8 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ from typing import Any
6
+
5
7
  from chromadb.api.types import EmbeddingFunction
6
8
  from chromadb.utils.embedding_functions import (
7
9
  CohereEmbeddingFunction,
@@ -34,7 +36,7 @@ FUNCTION_REGISTRY = {
34
36
  }
35
37
 
36
38
 
37
- def get_embedding_function(function_name: str, **kwargs) -> EmbeddingFunction:
39
+ def get_embedding_function(function_name: str, **kwargs: Any) -> EmbeddingFunction:
38
40
  """Load an embedding function by name.
39
41
 
40
42
  :param function_name: the name of the embedding function.
File without changes