chroma-haystack 2.0.0__tar.gz → 2.0.2__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.
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/CHANGELOG.md +115 -11
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/PKG-INFO +5 -3
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/pyproject.toml +3 -7
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/document_stores/chroma/document_store.py +28 -19
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/tests/test_document_store.py +22 -14
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/.gitignore +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/LICENSE +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/README.md +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_01.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_02.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_03.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_04.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_05.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_06.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_07.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_08.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_09.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_10.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_11.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_12.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_20.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_21.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_22.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_23.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_24.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_25.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_26.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_27.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_28.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_29.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_30.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_31.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_32.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_40.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_41.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_42.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_43.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_44.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_45.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_46.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_50.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_51.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_52.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/data/usr_90.txt +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/example/example.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/pydoc/config.yml +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/components/retrievers/chroma/__init__.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/components/retrievers/chroma/retriever.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/document_stores/chroma/__init__.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/document_stores/chroma/errors.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/document_stores/chroma/filters.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/src/haystack_integrations/document_stores/chroma/utils.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/tests/__init__.py +0 -0
- {chroma_haystack-2.0.0 → chroma_haystack-2.0.2}/tests/test_retriever.py +0 -0
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/chroma-v3.0.0] - 2025-03-11
|
|
4
|
+
|
|
5
|
+
### 🧹 Chores
|
|
6
|
+
|
|
7
|
+
- Use Haystack logging across integrations (#1484)
|
|
8
|
+
|
|
9
|
+
### 🌀 Miscellaneous
|
|
10
|
+
|
|
11
|
+
- Fix: Chroma - relax dataframe/blob test (#1404)
|
|
12
|
+
- Pin haystack and remove dataframe checks (#1501)
|
|
13
|
+
|
|
14
|
+
## [integrations/chroma-v2.0.1] - 2025-02-14
|
|
15
|
+
|
|
16
|
+
### 🌀 Miscellaneous
|
|
17
|
+
|
|
18
|
+
- Better handle discarded fields (#1373)
|
|
19
|
+
|
|
20
|
+
## [integrations/chroma-v1.0.1] - 2025-02-14
|
|
21
|
+
|
|
22
|
+
### 🧹 Chores
|
|
23
|
+
|
|
24
|
+
- Inherit from `FilterDocumentsTestWithDataframe` in Document Stores (#1290)
|
|
25
|
+
|
|
26
|
+
### 🌀 Miscellaneous
|
|
27
|
+
|
|
28
|
+
- Fix: Chroma - make `filter_documents` method return embeddings (#1361)
|
|
29
|
+
|
|
30
|
+
## [integrations/chroma-v2.0.0] - 2025-01-02
|
|
31
|
+
|
|
32
|
+
### 🧹 Chores
|
|
33
|
+
|
|
34
|
+
- Fix linting/isort (#1215)
|
|
35
|
+
- Chroma - pin `tokenizers` (#1223)
|
|
36
|
+
|
|
37
|
+
### 🌀 Miscellaneous
|
|
38
|
+
|
|
39
|
+
- Unpin tokenizers (#1233)
|
|
40
|
+
- Fix: updates for Chroma 0.6.0 (#1270)
|
|
41
|
+
|
|
3
42
|
## [integrations/chroma-v1.0.0] - 2024-11-06
|
|
4
43
|
|
|
5
44
|
### 🐛 Bug Fixes
|
|
@@ -7,13 +46,14 @@
|
|
|
7
46
|
- Fixing Chroma tests due `chromadb` update behaviour change (#1148)
|
|
8
47
|
- Adapt our implementation to breaking changes in Chroma 0.5.17 (#1165)
|
|
9
48
|
|
|
10
|
-
### ⚙️
|
|
49
|
+
### ⚙️ CI
|
|
11
50
|
|
|
12
51
|
- Adopt uv as installer (#1142)
|
|
13
52
|
|
|
53
|
+
|
|
14
54
|
## [integrations/chroma-v0.22.1] - 2024-09-30
|
|
15
55
|
|
|
16
|
-
###
|
|
56
|
+
### 🌀 Miscellaneous
|
|
17
57
|
|
|
18
58
|
- Empty filters should behave as no filters (#1117)
|
|
19
59
|
|
|
@@ -26,32 +66,36 @@
|
|
|
26
66
|
|
|
27
67
|
### 🐛 Bug Fixes
|
|
28
68
|
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>
|
|
69
|
+
- Refactor: fix chroma linting; do not use numpy (#1063)
|
|
32
70
|
- Filters in chroma integration (#1072)
|
|
33
71
|
|
|
34
72
|
### 🧪 Testing
|
|
35
73
|
|
|
36
74
|
- Do not retry tests in `hatch run test` command (#954)
|
|
37
75
|
|
|
38
|
-
###
|
|
76
|
+
### 🧹 Chores
|
|
39
77
|
|
|
40
78
|
- Chroma - ruff update, don't ruff tests (#983)
|
|
41
79
|
- Update ruff linting scripts and settings (#1105)
|
|
42
80
|
|
|
81
|
+
### 🌀 Miscellaneous
|
|
82
|
+
|
|
83
|
+
- Chore: ChromaDocumentStore lint fix (#1065)
|
|
84
|
+
|
|
43
85
|
## [integrations/chroma-v0.21.1] - 2024-07-17
|
|
44
86
|
|
|
45
87
|
### 🐛 Bug Fixes
|
|
46
88
|
|
|
47
89
|
- `ChromaDocumentStore` - discard `meta` items when the type of their value is not supported in Chroma (#907)
|
|
48
90
|
|
|
91
|
+
|
|
49
92
|
## [integrations/chroma-v0.21.0] - 2024-07-16
|
|
50
93
|
|
|
51
94
|
### 🚀 Features
|
|
52
95
|
|
|
53
96
|
- Add metadata parameter to ChromaDocumentStore. (#906)
|
|
54
97
|
|
|
98
|
+
|
|
55
99
|
## [integrations/chroma-v0.20.1] - 2024-07-15
|
|
56
100
|
|
|
57
101
|
### 🚀 Features
|
|
@@ -64,15 +108,32 @@ Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>
|
|
|
64
108
|
- Allow search in ChromaDocumentStore without metadata (#863)
|
|
65
109
|
- `Chroma` - Fallback to default filter policy when deserializing retrievers without the init parameter (#897)
|
|
66
110
|
|
|
67
|
-
### ⚙️
|
|
111
|
+
### ⚙️ CI
|
|
68
112
|
|
|
69
113
|
- Retry tests to reduce flakyness (#836)
|
|
114
|
+
|
|
115
|
+
### 🧹 Chores
|
|
116
|
+
|
|
70
117
|
- Update ruff invocation to include check parameter (#853)
|
|
71
118
|
|
|
119
|
+
### 🌀 Miscellaneous
|
|
120
|
+
|
|
121
|
+
- Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845)
|
|
122
|
+
- Chore: Minor retriever pydoc fix (#884)
|
|
123
|
+
|
|
72
124
|
## [integrations/chroma-v0.18.0] - 2024-05-31
|
|
73
125
|
|
|
126
|
+
### 🌀 Miscellaneous
|
|
127
|
+
|
|
128
|
+
- Chore: pin chromadb>=0.5.0 (#777)
|
|
129
|
+
|
|
74
130
|
## [integrations/chroma-v0.17.0] - 2024-05-10
|
|
75
131
|
|
|
132
|
+
### 🌀 Miscellaneous
|
|
133
|
+
|
|
134
|
+
- Chore: change the pydoc renderer class (#718)
|
|
135
|
+
- Implement filters for chromaQueryTextRetriever via existing haystack filters logic (#705)
|
|
136
|
+
|
|
76
137
|
## [integrations/chroma-v0.16.0] - 2024-05-02
|
|
77
138
|
|
|
78
139
|
### 📚 Documentation
|
|
@@ -80,15 +141,27 @@ Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>
|
|
|
80
141
|
- Small consistency improvements (#536)
|
|
81
142
|
- Disable-class-def (#556)
|
|
82
143
|
|
|
144
|
+
### 🌀 Miscellaneous
|
|
145
|
+
|
|
146
|
+
- Make tests show coverage (#566)
|
|
147
|
+
- Refactor tests (#574)
|
|
148
|
+
- Remove references to Python 3.7 (#601)
|
|
149
|
+
- Make Document Stores initially skip `SparseEmbedding` (#606)
|
|
150
|
+
- Pin databind-core (#619)
|
|
151
|
+
- Chore: add license classifiers (#680)
|
|
152
|
+
- Feature/bump chromadb dep to 0.5.0 (#700)
|
|
153
|
+
|
|
83
154
|
## [integrations/chroma-v0.15.0] - 2024-03-01
|
|
84
155
|
|
|
156
|
+
### 🌀 Miscellaneous
|
|
157
|
+
|
|
158
|
+
- Release chroma on python 3.8 (#512)
|
|
159
|
+
|
|
85
160
|
## [integrations/chroma-v0.14.0] - 2024-02-29
|
|
86
161
|
|
|
87
162
|
### 🐛 Bug Fixes
|
|
88
163
|
|
|
89
164
|
- Fix order of API docs (#447)
|
|
90
|
-
|
|
91
|
-
This PR will also push the docs to Readme
|
|
92
165
|
- Serialize the path to the local db (#506)
|
|
93
166
|
|
|
94
167
|
### 📚 Documentation
|
|
@@ -96,35 +169,59 @@ This PR will also push the docs to Readme
|
|
|
96
169
|
- Update category slug (#442)
|
|
97
170
|
- Review chroma integration (#501)
|
|
98
171
|
|
|
172
|
+
### 🌀 Miscellaneous
|
|
173
|
+
|
|
174
|
+
- Small improvements (#443)
|
|
175
|
+
- Fix: make write_documents compatible with the DocumentStore protocol (#505)
|
|
176
|
+
|
|
99
177
|
## [integrations/chroma-v0.13.0] - 2024-02-13
|
|
100
178
|
|
|
179
|
+
### 🌀 Miscellaneous
|
|
180
|
+
|
|
181
|
+
- Chroma: rename retriever (#407)
|
|
182
|
+
|
|
101
183
|
## [integrations/chroma-v0.12.0] - 2024-02-06
|
|
102
184
|
|
|
103
185
|
### 🚀 Features
|
|
104
186
|
|
|
105
187
|
- Generate API docs (#262)
|
|
106
188
|
|
|
189
|
+
### 🌀 Miscellaneous
|
|
190
|
+
|
|
191
|
+
- Add typing_extensions pin to Chroma integration (#295)
|
|
192
|
+
- Allows filters and persistent document stores for Chroma (#342)
|
|
193
|
+
|
|
107
194
|
## [integrations/chroma-v0.11.0] - 2024-01-18
|
|
108
195
|
|
|
109
196
|
### 🐛 Bug Fixes
|
|
110
197
|
|
|
111
198
|
- Chroma DocumentStore creation for pre-existing collection name (#157)
|
|
112
199
|
|
|
200
|
+
### 🌀 Miscellaneous
|
|
201
|
+
|
|
202
|
+
- Mount chroma integration under `haystack_integrations.*` (#193)
|
|
203
|
+
- Remove ChromaSingleQueryRetriever (#240)
|
|
204
|
+
|
|
113
205
|
## [integrations/chroma-v0.9.0] - 2023-12-20
|
|
114
206
|
|
|
115
207
|
### 🐛 Bug Fixes
|
|
116
208
|
|
|
117
|
-
- Fix project
|
|
209
|
+
- Fix project URLs (#96)
|
|
118
210
|
|
|
119
211
|
### 🚜 Refactor
|
|
120
212
|
|
|
121
213
|
- Use `hatch_vcs` to manage integrations versioning (#103)
|
|
122
214
|
|
|
215
|
+
### 🌀 Miscellaneous
|
|
216
|
+
|
|
217
|
+
- Chore: pin chroma version (#104)
|
|
218
|
+
- Fix: update to the latest Document format (#127)
|
|
219
|
+
|
|
123
220
|
## [integrations/chroma-v0.8.1] - 2023-12-05
|
|
124
221
|
|
|
125
222
|
### 🐛 Bug Fixes
|
|
126
223
|
|
|
127
|
-
-
|
|
224
|
+
- Document Stores: fix protocol import (#77)
|
|
128
225
|
|
|
129
226
|
## [integrations/chroma-v0.8.0] - 2023-12-04
|
|
130
227
|
|
|
@@ -132,4 +229,11 @@ This PR will also push the docs to Readme
|
|
|
132
229
|
|
|
133
230
|
- Fix license headers
|
|
134
231
|
|
|
232
|
+
### 🌀 Miscellaneous
|
|
233
|
+
|
|
234
|
+
- Reorganize repository (#62)
|
|
235
|
+
- Update import paths (#64)
|
|
236
|
+
- Patch chroma filters tests (#67)
|
|
237
|
+
- Remove Document Store decorator (#76)
|
|
238
|
+
|
|
135
239
|
<!-- generated by git-cliff -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chroma-haystack
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
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
|
|
@@ -13,11 +13,13 @@ Classifier: Programming Language :: Python
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
19
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
18
20
|
Requires-Python: >=3.9
|
|
19
|
-
Requires-Dist: chromadb
|
|
20
|
-
Requires-Dist: haystack-ai
|
|
21
|
+
Requires-Dist: chromadb<1,>=0.6.0
|
|
22
|
+
Requires-Dist: haystack-ai>=2.11.0
|
|
21
23
|
Description-Content-Type: text/markdown
|
|
22
24
|
|
|
23
25
|
# Chroma Document Store for Haystack
|
|
@@ -18,13 +18,12 @@ classifiers = [
|
|
|
18
18
|
"Programming Language :: Python :: 3.9",
|
|
19
19
|
"Programming Language :: Python :: 3.10",
|
|
20
20
|
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
21
23
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
22
24
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
23
25
|
]
|
|
24
|
-
dependencies = [
|
|
25
|
-
"haystack-ai",
|
|
26
|
-
"chromadb>=0.6.0",
|
|
27
|
-
]
|
|
26
|
+
dependencies = ["haystack-ai>=2.11.0", "chromadb>=0.6.0,<1"]
|
|
28
27
|
|
|
29
28
|
[project.urls]
|
|
30
29
|
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/chroma#readme"
|
|
@@ -60,9 +59,6 @@ cov = ["test-cov", "cov-report"]
|
|
|
60
59
|
cov-retry = ["test-cov-retry", "cov-report"]
|
|
61
60
|
docs = ["pydoc-markdown pydoc/config.yml"]
|
|
62
61
|
|
|
63
|
-
[[tool.hatch.envs.all.matrix]]
|
|
64
|
-
python = ["3.9", "3.10"]
|
|
65
|
-
|
|
66
62
|
[tool.hatch.envs.lint]
|
|
67
63
|
installer = "uv"
|
|
68
64
|
detached = true
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2023-present John Doe <jd@example.com>
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import logging
|
|
5
4
|
from typing import Any, Dict, List, Literal, Optional
|
|
6
5
|
|
|
7
6
|
import chromadb
|
|
8
7
|
from chromadb.api.types import GetResult, QueryResult
|
|
9
|
-
from haystack import default_from_dict, default_to_dict
|
|
8
|
+
from haystack import default_from_dict, default_to_dict, logging
|
|
10
9
|
from haystack.dataclasses import Document
|
|
11
10
|
from haystack.document_stores.types import DuplicatePolicy
|
|
11
|
+
from numpy import ndarray
|
|
12
12
|
|
|
13
13
|
from .filters import _convert_filters
|
|
14
14
|
from .utils import get_embedding_function
|
|
@@ -208,18 +208,18 @@ class ChromaDocumentStore:
|
|
|
208
208
|
self._ensure_initialized()
|
|
209
209
|
assert self._collection is not None
|
|
210
210
|
|
|
211
|
+
kwargs: Dict[str, Any] = {"include": ["embeddings", "documents", "metadatas"]}
|
|
212
|
+
|
|
211
213
|
if filters:
|
|
212
214
|
chroma_filter = _convert_filters(filters)
|
|
213
|
-
kwargs
|
|
215
|
+
kwargs["where"] = chroma_filter.where
|
|
214
216
|
|
|
215
217
|
if chroma_filter.ids:
|
|
216
218
|
kwargs["ids"] = chroma_filter.ids
|
|
217
219
|
if chroma_filter.where_document:
|
|
218
220
|
kwargs["where_document"] = chroma_filter.where_document
|
|
219
221
|
|
|
220
|
-
|
|
221
|
-
else:
|
|
222
|
-
result = self._collection.get()
|
|
222
|
+
result = self._collection.get(**kwargs)
|
|
223
223
|
|
|
224
224
|
return self._get_result_to_documents(result)
|
|
225
225
|
|
|
@@ -249,11 +249,17 @@ class ChromaDocumentStore:
|
|
|
249
249
|
if doc.content is None:
|
|
250
250
|
logger.warning(
|
|
251
251
|
"ChromaDocumentStore cannot store documents with `content=None`. "
|
|
252
|
-
"
|
|
253
|
-
|
|
254
|
-
doc.id,
|
|
252
|
+
"Document with id {doc_id} will be skipped.",
|
|
253
|
+
doc_id=doc.id,
|
|
255
254
|
)
|
|
256
255
|
continue
|
|
256
|
+
elif hasattr(doc, "blob") and doc.blob is not None:
|
|
257
|
+
logger.warning(
|
|
258
|
+
"Document with id {doc_id} contains the `blob` field. "
|
|
259
|
+
"ChromaDocumentStore cannot store `blob` fields. "
|
|
260
|
+
"This field will be ignored.",
|
|
261
|
+
doc_id=doc.id,
|
|
262
|
+
)
|
|
257
263
|
data = {"ids": [doc.id], "documents": [doc.content]}
|
|
258
264
|
|
|
259
265
|
if doc.meta:
|
|
@@ -268,11 +274,11 @@ class ChromaDocumentStore:
|
|
|
268
274
|
|
|
269
275
|
if discarded_keys:
|
|
270
276
|
logger.warning(
|
|
271
|
-
"Document
|
|
272
|
-
"These items will be discarded. Supported types are:
|
|
273
|
-
doc.id,
|
|
274
|
-
", ".join(discarded_keys),
|
|
275
|
-
", ".join([t.__name__ for t in SUPPORTED_TYPES_FOR_METADATA_VALUES]),
|
|
277
|
+
"Document {doc_id} contains `meta` values of unsupported types for the keys: {keys}. "
|
|
278
|
+
"These items will be discarded. Supported types are: {types}.",
|
|
279
|
+
doc_id=doc.id,
|
|
280
|
+
keys=", ".join(discarded_keys),
|
|
281
|
+
types=", ".join([t.__name__ for t in SUPPORTED_TYPES_FOR_METADATA_VALUES]),
|
|
276
282
|
)
|
|
277
283
|
|
|
278
284
|
if valid_meta:
|
|
@@ -283,10 +289,10 @@ class ChromaDocumentStore:
|
|
|
283
289
|
|
|
284
290
|
if hasattr(doc, "sparse_embedding") and doc.sparse_embedding is not None:
|
|
285
291
|
logger.warning(
|
|
286
|
-
"Document
|
|
287
|
-
"but storing sparse embeddings in Chroma is not currently supported."
|
|
292
|
+
"Document {doc_id} has the `sparse_embedding` field set, "
|
|
293
|
+
"but storing sparse embeddings in Chroma is not currently supported. "
|
|
288
294
|
"The `sparse_embedding` field will be ignored.",
|
|
289
|
-
doc.id,
|
|
295
|
+
doc_id=doc.id,
|
|
290
296
|
)
|
|
291
297
|
|
|
292
298
|
self._collection.add(**data)
|
|
@@ -416,8 +422,11 @@ class ChromaDocumentStore:
|
|
|
416
422
|
document_dict["meta"] = result_metadata[i]
|
|
417
423
|
|
|
418
424
|
result_embeddings = result.get("embeddings")
|
|
419
|
-
if result_embeddings:
|
|
420
|
-
|
|
425
|
+
if result_embeddings is not None:
|
|
426
|
+
if isinstance(result_embeddings[i], ndarray):
|
|
427
|
+
document_dict["embedding"] = result_embeddings[i].tolist()
|
|
428
|
+
else:
|
|
429
|
+
document_dict["embedding"] = result_embeddings[i]
|
|
421
430
|
|
|
422
431
|
retval.append(Document.from_dict(document_dict))
|
|
423
432
|
|
|
@@ -11,7 +11,7 @@ from unittest import mock
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
import pytest
|
|
13
13
|
from chromadb.api.types import Documents, EmbeddingFunction, Embeddings
|
|
14
|
-
from haystack import Document
|
|
14
|
+
from haystack.dataclasses import ByteStream, Document
|
|
15
15
|
from haystack.testing.document_store import (
|
|
16
16
|
TEST_EMBEDDING_1,
|
|
17
17
|
TEST_EMBEDDING_2,
|
|
@@ -179,7 +179,13 @@ class TestDocumentStore(CountDocumentsTest, DeleteDocumentsTest, FilterDocuments
|
|
|
179
179
|
document_store.write_documents([doc])
|
|
180
180
|
document_store.delete_documents(["non_existing"])
|
|
181
181
|
filters = {"operator": "==", "field": "id", "value": doc.id}
|
|
182
|
-
|
|
182
|
+
|
|
183
|
+
assert document_store.filter_documents(filters=filters)[0].id == doc.id
|
|
184
|
+
|
|
185
|
+
def test_filter_documents_return_embeddings(self, document_store: ChromaDocumentStore):
|
|
186
|
+
document_store.write_documents([Document(content="test doc", embedding=TEST_EMBEDDING_1)])
|
|
187
|
+
|
|
188
|
+
assert document_store.filter_documents()[0].embedding == pytest.approx(TEST_EMBEDDING_1)
|
|
183
189
|
|
|
184
190
|
def test_search(self):
|
|
185
191
|
document_store = ChromaDocumentStore()
|
|
@@ -227,6 +233,20 @@ class TestDocumentStore(CountDocumentsTest, DeleteDocumentsTest, FilterDocuments
|
|
|
227
233
|
assert written_docs[1].meta == {}
|
|
228
234
|
assert written_docs[2].meta == {"ok": 123}
|
|
229
235
|
|
|
236
|
+
def test_documents_with_content_none_are_not_stored(self, document_store: ChromaDocumentStore):
|
|
237
|
+
document_store.write_documents([Document(content=None)])
|
|
238
|
+
assert document_store.filter_documents() == []
|
|
239
|
+
|
|
240
|
+
def test_blob_not_stored(self, document_store: ChromaDocumentStore):
|
|
241
|
+
bs = ByteStream(data=b"test")
|
|
242
|
+
doc_mixed = Document(content="test", blob=bs)
|
|
243
|
+
|
|
244
|
+
document_store.write_documents([doc_mixed])
|
|
245
|
+
|
|
246
|
+
retrieved_doc = document_store.filter_documents()[0]
|
|
247
|
+
assert retrieved_doc.content == "test"
|
|
248
|
+
assert retrieved_doc.blob is None
|
|
249
|
+
|
|
230
250
|
@pytest.mark.integration
|
|
231
251
|
def test_to_dict(self, request):
|
|
232
252
|
ds = ChromaDocumentStore(
|
|
@@ -406,18 +426,6 @@ class TestDocumentStore(CountDocumentsTest, DeleteDocumentsTest, FilterDocuments
|
|
|
406
426
|
],
|
|
407
427
|
)
|
|
408
428
|
|
|
409
|
-
@pytest.mark.skip(reason="Filter on dataframe contents is not supported.")
|
|
410
|
-
def test_comparison_equal_with_dataframe(
|
|
411
|
-
self, document_store: ChromaDocumentStore, filterable_docs: List[Document]
|
|
412
|
-
):
|
|
413
|
-
pass
|
|
414
|
-
|
|
415
|
-
@pytest.mark.skip(reason="Filter on dataframe contents is not supported.")
|
|
416
|
-
def test_comparison_not_equal_with_dataframe(
|
|
417
|
-
self, document_store: ChromaDocumentStore, filterable_docs: List[Document]
|
|
418
|
-
):
|
|
419
|
-
pass
|
|
420
|
-
|
|
421
429
|
@pytest.mark.skip(reason="Chroma does not support comparison with null values")
|
|
422
430
|
def test_comparison_equal_with_none(self, document_store, filterable_docs):
|
|
423
431
|
pass
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|