projectdavid 1.33.18__py3-none-any.whl → 1.33.19__py3-none-any.whl
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.
Potentially problematic release.
This version of projectdavid might be problematic. Click here for more details.
- projectdavid/clients/vector_store_manager.py +34 -29
- {projectdavid-1.33.18.dist-info → projectdavid-1.33.19.dist-info}/METADATA +1 -1
- {projectdavid-1.33.18.dist-info → projectdavid-1.33.19.dist-info}/RECORD +6 -6
- {projectdavid-1.33.18.dist-info → projectdavid-1.33.19.dist-info}/WHEEL +0 -0
- {projectdavid-1.33.18.dist-info → projectdavid-1.33.19.dist-info}/licenses/LICENSE +0 -0
- {projectdavid-1.33.18.dist-info → projectdavid-1.33.19.dist-info}/top_level.txt +0 -0
|
@@ -7,6 +7,7 @@ details from the higher‑level SDK.
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
+
import inspect
|
|
10
11
|
import time
|
|
11
12
|
import uuid
|
|
12
13
|
from pathlib import Path
|
|
@@ -129,48 +130,45 @@ class VectorStoreManager(BaseVectorStore):
|
|
|
129
130
|
log.error("Store info failed: %s", e)
|
|
130
131
|
raise VectorStoreError(f"Info retrieval failed: {e}") from e
|
|
131
132
|
|
|
132
|
-
# ------------------------------------------------------------------ #
|
|
133
|
-
# ingestion helpers
|
|
134
|
-
# ------------------------------------------------------------------ #
|
|
135
133
|
def add_to_store(
|
|
136
134
|
self,
|
|
135
|
+
*,
|
|
137
136
|
store_name: str,
|
|
138
137
|
texts: List[str],
|
|
139
138
|
vectors: List[List[float]],
|
|
140
139
|
metadata: List[dict],
|
|
141
|
-
*,
|
|
142
140
|
vector_name: Optional[str] = None,
|
|
143
|
-
):
|
|
141
|
+
) -> Dict[str, Any]:
|
|
142
|
+
"""Upsert vectors + payloads into *store_name*.
|
|
143
|
+
|
|
144
|
+
If *vector_name* is omitted, the manager auto‑detects the sole vector
|
|
145
|
+
field. If multiple fields exist it raises a clear error.
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
# ---- validate input ------------------------------------------------
|
|
144
149
|
if not vectors:
|
|
145
150
|
raise ValueError("Empty vectors list")
|
|
146
151
|
expected = len(vectors[0])
|
|
147
152
|
for i, vec in enumerate(vectors):
|
|
148
153
|
if len(vec) != expected or not all(isinstance(v, float) for v in vec):
|
|
149
|
-
raise ValueError(f"Vector {i} malformed")
|
|
154
|
+
raise ValueError(f"Vector {i} malformed: expected {expected} floats")
|
|
150
155
|
|
|
151
|
-
#
|
|
156
|
+
# ---- auto‑detect vector field --------------------------------------
|
|
152
157
|
if vector_name is None:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
# Qdrant 1.x vs 2.x compatibility
|
|
157
|
-
if isinstance(vectors_config, dict):
|
|
158
|
-
vector_fields = list(vectors_config.keys())
|
|
159
|
-
else:
|
|
160
|
-
vector_fields = [vectors_config]
|
|
161
|
-
|
|
158
|
+
coll_info = self.client.get_collection(collection_name=store_name)
|
|
159
|
+
v_cfg = coll_info.config.params.vectors
|
|
160
|
+
vector_fields = list(v_cfg.keys()) if isinstance(v_cfg, dict) else [v_cfg]
|
|
162
161
|
if len(vector_fields) == 1:
|
|
163
162
|
vector_name = vector_fields[0]
|
|
164
163
|
log.debug(
|
|
165
|
-
"Auto
|
|
166
|
-
vector_name,
|
|
167
|
-
store_name,
|
|
164
|
+
"Auto‑detected vector_name=%r for store=%s", vector_name, store_name
|
|
168
165
|
)
|
|
169
166
|
else:
|
|
170
167
|
raise ValueError(
|
|
171
|
-
f"Multiple vector fields
|
|
168
|
+
f"Multiple vector fields {vector_fields}; please specify vector_name"
|
|
172
169
|
)
|
|
173
170
|
|
|
171
|
+
# ---- build points ---------------------------------------------------
|
|
174
172
|
points = [
|
|
175
173
|
qdrant.PointStruct(
|
|
176
174
|
id=self._generate_vector_id(),
|
|
@@ -180,17 +178,24 @@ class VectorStoreManager(BaseVectorStore):
|
|
|
180
178
|
for txt, vec, meta in zip(texts, vectors, metadata)
|
|
181
179
|
]
|
|
182
180
|
|
|
181
|
+
# ---- upsert with backward‑compat for old clients --------------------
|
|
182
|
+
upsert_sig = inspect.signature(self.client.upsert)
|
|
183
|
+
supports_vector_name = "vector_name" in upsert_sig.parameters
|
|
184
|
+
|
|
185
|
+
upsert_kwargs: Dict[str, Any] = {
|
|
186
|
+
"collection_name": store_name,
|
|
187
|
+
"points": points,
|
|
188
|
+
"wait": True,
|
|
189
|
+
}
|
|
190
|
+
if supports_vector_name:
|
|
191
|
+
upsert_kwargs["vector_name"] = vector_name
|
|
192
|
+
|
|
183
193
|
try:
|
|
184
|
-
self.client.upsert(
|
|
185
|
-
collection_name=store_name,
|
|
186
|
-
points=points,
|
|
187
|
-
wait=True,
|
|
188
|
-
vector_name=vector_name,
|
|
189
|
-
)
|
|
194
|
+
self.client.upsert(**upsert_kwargs)
|
|
190
195
|
return {"status": "success", "points_inserted": len(points)}
|
|
191
|
-
except Exception as
|
|
192
|
-
log.error("Add‑to‑store failed: %s",
|
|
193
|
-
raise VectorStoreError(f"Insertion failed: {
|
|
196
|
+
except Exception as exc: # noqa: BLE001
|
|
197
|
+
log.error("Add‑to‑store failed: %s", exc, exc_info=True)
|
|
198
|
+
raise VectorStoreError(f"Insertion failed: {exc}") from exc
|
|
194
199
|
|
|
195
200
|
# ------------------------------------------------------------------ #
|
|
196
201
|
# search / query
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: projectdavid
|
|
3
|
-
Version: 1.33.
|
|
3
|
+
Version: 1.33.19
|
|
4
4
|
Summary: Python SDK for interacting with the Entities Assistant API.
|
|
5
5
|
Author-email: Francis Neequaye Armah <francis.neequaye@projectdavid.co.uk>
|
|
6
6
|
License: PolyForm Noncommercial License 1.0.0
|
|
@@ -20,7 +20,7 @@ projectdavid/clients/synchronous_inference_wrapper.py,sha256=qh94rtNlLqgIxiA_ZbQ
|
|
|
20
20
|
projectdavid/clients/threads_client.py,sha256=ekzU5w14zftmtmFkiec3NC90Of-_KVSUY1qH9cmfSFg,6771
|
|
21
21
|
projectdavid/clients/tools_client.py,sha256=GkCVOmwpAoPqVt6aYmH0G1HIFha3iEwR9IIf9teR0j8,11487
|
|
22
22
|
projectdavid/clients/users_client.py,sha256=eCuUb9qvyH1GUFhZu6TRL9zdoK-qzHSs8-Vmrk_0mmg,13729
|
|
23
|
-
projectdavid/clients/vector_store_manager.py,sha256=
|
|
23
|
+
projectdavid/clients/vector_store_manager.py,sha256=4uedMZ7foNr7s4Lsq5-FSN5kl4lR-Y8-nUlkoO2ff8M,14119
|
|
24
24
|
projectdavid/clients/vectors.py,sha256=ubkB4rzcfDSYHFwOpa99Y4nHSJan_0jKnzyCYFJ15ck,31665
|
|
25
25
|
projectdavid/clients/vision-file_processor.py,sha256=19ft9IUeY5x9_22vC4JqndiFlpDYyUn6z1ygv-EV2NE,16852
|
|
26
26
|
projectdavid/clients/vision_vectors.py,sha256=cysPVbUzW3byB82MTqG2X1Iz5ZAe82WTS1JfQcoqVhE,40229
|
|
@@ -37,8 +37,8 @@ projectdavid/utils/monitor_launcher.py,sha256=3YAgJdeuaUvq3JGvpA4ymqFsAnk29nH5q9
|
|
|
37
37
|
projectdavid/utils/peek_gate.py,sha256=5whMRnDOQjATRpThWDJkvY9ScXuJ7Sd_-9rvGgXeTAQ,2532
|
|
38
38
|
projectdavid/utils/run_monitor.py,sha256=F_WkqIP-qnWH-4llIbileWWLfRj2Q1Cg-ni23SR1rec,3786
|
|
39
39
|
projectdavid/utils/vector_search_formatter.py,sha256=YTe3HPGec26qGY7uxY8_GS8lc4QaN6aNXMzkl29nZpI,1735
|
|
40
|
-
projectdavid-1.33.
|
|
41
|
-
projectdavid-1.33.
|
|
42
|
-
projectdavid-1.33.
|
|
43
|
-
projectdavid-1.33.
|
|
44
|
-
projectdavid-1.33.
|
|
40
|
+
projectdavid-1.33.19.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
|
|
41
|
+
projectdavid-1.33.19.dist-info/METADATA,sha256=eXDpkgLi7akRbAzqob6TB1B4veUNoMY0EOwf7QH_Rpo,11555
|
|
42
|
+
projectdavid-1.33.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
projectdavid-1.33.19.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
|
|
44
|
+
projectdavid-1.33.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|