projectdavid 1.30.0__py3-none-any.whl → 1.30.2__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.

@@ -138,7 +138,6 @@ class FileProcessor:
138
138
  }
139
139
 
140
140
  # ——— NEW: CSV pipeline ——— #
141
-
142
141
  async def _process_csv(
143
142
  self, file_path: Path, text_field: str = "description"
144
143
  ) -> Dict[str, Any]:
@@ -454,19 +454,107 @@ class VectorStoreClient:
454
454
  )
455
455
  )
456
456
 
457
+ # ───────────────────────────────────────────────────────────────
458
+ # Convenience: ensure a per-user “file_search” store exists
459
+ # ───────────────────────────────────────────────────────────────
460
+ # unchanged … (get_or_create_file_search_store)
461
+
457
462
  def list_my_vector_stores(self) -> List[ValidationInterface.VectorStoreRead]:
458
- """List all non-deleted stores owned by the caller."""
463
+ """List all non-deleted stores owned by *this* API-key’s user."""
459
464
  return self._run_sync(self._list_my_vs_async())
460
465
 
466
+ # ───────────────────────────────────────────────────────────────
467
+ # NEW: real per-user listing (admin-only)
468
+ # ───────────────────────────────────────────────────────────────
469
+ async def _list_vs_by_user_async(
470
+ self, user_id: str
471
+ ) -> List[ValidationInterface.VectorStoreRead]:
472
+ """
473
+ Admin-scope helper – fetch every (non-deleted) vector-store
474
+ belonging to **user_id**.
475
+ """
476
+ resp = await self._request(
477
+ "GET",
478
+ "/v1/vector-stores",
479
+ params={"owner_id": user_id},
480
+ )
481
+ return [ValidationInterface.VectorStoreRead.model_validate(r) for r in resp]
482
+
461
483
  def get_stores_by_user(
462
- self, _user_id: str
484
+ self,
485
+ _user_id: str,
463
486
  ) -> List[ValidationInterface.VectorStoreRead]: # noqa: ARG002
487
+ """
488
+ ⚠️ **Deprecated** – prefer impersonating the user’s API-key or using
489
+ the newer RBAC endpoints, but keep working for legacy code.
490
+ """
464
491
  warnings.warn(
465
- "`get_stores_by_user()` is deprecated; use `list_my_vector_stores()`.",
492
+ "`get_stores_by_user()` is deprecated; use `list_my_vector_stores()` or "
493
+ "`VectorStoreClient(list_my_vector_stores)` with an impersonated key.",
466
494
  DeprecationWarning,
467
495
  stacklevel=2,
468
496
  )
469
- return self.list_my_vector_stores()
497
+ return self._run_sync(self._list_vs_by_user_async(_user_id))
498
+
499
+ # ───────────────────────────────────────────────────────────────
500
+ # Convenience: ensure a per-user “file_search” store exists
501
+ # ───────────────────────────────────────────────────────────────
502
+ def get_or_create_file_search_store(self, user_id: Optional[str] = None) -> str:
503
+ """
504
+ Return the *oldest* vector-store named **file_search** for ``user_id``;
505
+ create one if none exist.
506
+
507
+ Parameters
508
+ ----------
509
+ user_id : Optional[str]
510
+ • If **None** → operate on *this* API-key’s stores
511
+ • If not None → *admin-only* – look up / create on behalf of ``user_id``
512
+
513
+ Returns
514
+ -------
515
+ str
516
+ The vector-store **id**.
517
+ """
518
+
519
+ # 1️⃣ Fetch candidate stores
520
+ if user_id is None:
521
+ # Normal user context – only see caller-owned stores
522
+ stores = self.list_my_vector_stores()
523
+ else:
524
+ # Admin context – may inspect another user’s stores
525
+ stores = self.get_stores_by_user(_user_id=user_id)
526
+
527
+ file_search_stores = [s for s in stores if s.name == "file_search"]
528
+
529
+ if file_search_stores:
530
+ # 2️⃣ Pick the *earliest* (oldest created_at) to keep things stable
531
+ chosen = min(
532
+ file_search_stores,
533
+ key=lambda s: (s.created_at or 0),
534
+ )
535
+ log.info(
536
+ "Re-using existing 'file_search' store %s for user %s",
537
+ chosen.id,
538
+ user_id or "<self>",
539
+ )
540
+ return chosen.id
541
+
542
+ # 3️⃣ Nothing found → create a fresh store
543
+ if user_id is None:
544
+ new_store = self.create_vector_store(name="file_search")
545
+ else:
546
+ # Requires admin API-key
547
+ new_store = self.create_vector_store_for_user(
548
+ owner_id=user_id,
549
+ name="file_search",
550
+ )
551
+
552
+ log.info(
553
+ "Created new 'file_search' store %s for user %s",
554
+ new_store.id,
555
+ user_id or "<self>",
556
+ )
557
+ return new_store.id
470
558
 
471
559
  def add_file_to_vector_store(
472
560
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid
3
- Version: 1.30.0
3
+ Version: 1.30.2
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
@@ -9,7 +9,7 @@ projectdavid/clients/assistants_client.py,sha256=SsIGa5wPr7ga9WX0ywam3djUF-uWFdk
9
9
  projectdavid/clients/base_client.py,sha256=UWl6nr6sxD1_xC6iyptQDR1tnNdFCOrEx5cEUPCRqJE,3417
10
10
  projectdavid/clients/base_vector_store.py,sha256=jXivmqAW1bgYcLgIeW-hPxOiWZbs2hCsLy4oWzSvpNI,2061
11
11
  projectdavid/clients/event_handler.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- projectdavid/clients/file_processor.py,sha256=fR-FfUFye5Ix85Iq1b7Hni8_X4JtJ_miSFVh2-Wh2mM,9942
12
+ projectdavid/clients/file_processor.py,sha256=97MYqpBcQOsPf1hiylPrNo0rJXBNMdSAP7JyAEC0nC0,9941
13
13
  projectdavid/clients/file_search.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  projectdavid/clients/files_client.py,sha256=XkIDzbQFGDrd88taf0Kouc_4YJOPIYEHiIyWYLKDofI,15581
15
15
  projectdavid/clients/inference_client.py,sha256=xz4ACPv5Tkis604QxO5mJX1inH_TGDfQP-31geETYpE,6609
@@ -20,7 +20,7 @@ projectdavid/clients/threads_client.py,sha256=ekzU5w14zftmtmFkiec3NC90Of-_KVSUY1
20
20
  projectdavid/clients/tools_client.py,sha256=GkCVOmwpAoPqVt6aYmH0G1HIFha3iEwR9IIf9teR0j8,11487
21
21
  projectdavid/clients/users_client.py,sha256=eCuUb9qvyH1GUFhZu6TRL9zdoK-qzHSs8-Vmrk_0mmg,13729
22
22
  projectdavid/clients/vector_store_manager.py,sha256=lk-sWJjo6Z0EHZzjRoKiHPr0GpEXfE4bJBQzmKV8ezc,11372
23
- projectdavid/clients/vectors.py,sha256=I8GrGJm2eYlHkWb9HKW9R7blKhNMFCX7AVqUT-AKxE4,27040
23
+ projectdavid/clients/vectors.py,sha256=WqRkTXPvAK6vMA-dgCxKvZ_71bSS3YEMdkXuA9LlC4o,31159
24
24
  projectdavid/constants/platform.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  projectdavid/services/logging_service.py,sha256=jdoRL46E42Ar8JFTDOV-xVD67CulcHSN-xhcEqA5CXQ,2643
26
26
  projectdavid/synthesis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -32,8 +32,8 @@ projectdavid/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
32
32
  projectdavid/utils/monitor_launcher.py,sha256=3YAgJdeuaUvq3JGvpA4ymqFsAnk29nH5q93cwStP4hc,2836
33
33
  projectdavid/utils/run_monitor.py,sha256=F_WkqIP-qnWH-4llIbileWWLfRj2Q1Cg-ni23SR1rec,3786
34
34
  projectdavid/utils/vector_search_formatter.py,sha256=YTe3HPGec26qGY7uxY8_GS8lc4QaN6aNXMzkl29nZpI,1735
35
- projectdavid-1.30.0.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
36
- projectdavid-1.30.0.dist-info/METADATA,sha256=H4qvz3w-Z4uWkKQdjGis7UdZXQRRSEUUoEzmTOt-RVc,10727
37
- projectdavid-1.30.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
38
- projectdavid-1.30.0.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
39
- projectdavid-1.30.0.dist-info/RECORD,,
35
+ projectdavid-1.30.2.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
36
+ projectdavid-1.30.2.dist-info/METADATA,sha256=h9MXTZZF7rG8oiCjDv6qZy5ERVBR3U7X_Cv0HFUvSQ0,10727
37
+ projectdavid-1.30.2.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
38
+ projectdavid-1.30.2.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
39
+ projectdavid-1.30.2.dist-info/RECORD,,