projectdavid 1.34.2__py3-none-any.whl → 1.34.4__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/runs.py +30 -158
- {projectdavid-1.34.2.dist-info → projectdavid-1.34.4.dist-info}/METADATA +1 -1
- {projectdavid-1.34.2.dist-info → projectdavid-1.34.4.dist-info}/RECORD +6 -6
- {projectdavid-1.34.2.dist-info → projectdavid-1.34.4.dist-info}/WHEEL +0 -0
- {projectdavid-1.34.2.dist-info → projectdavid-1.34.4.dist-info}/licenses/LICENSE +0 -0
- {projectdavid-1.34.2.dist-info → projectdavid-1.34.4.dist-info}/top_level.txt +0 -0
projectdavid/clients/runs.py
CHANGED
|
@@ -148,6 +148,25 @@ class RunsClient(BaseAPIClient):
|
|
|
148
148
|
)
|
|
149
149
|
raise
|
|
150
150
|
|
|
151
|
+
def update_run(self, run_id: str, metadata: Dict[str, Any]) -> ent_validator.Run:
|
|
152
|
+
"""
|
|
153
|
+
Shallow-merge metadata into a run. Returns the updated Run.
|
|
154
|
+
"""
|
|
155
|
+
logging_utility.info("Updating metadata for run_id: %s", run_id)
|
|
156
|
+
try:
|
|
157
|
+
resp = self.client.put(f"/v1/runs/{run_id}/metadata", json=metadata)
|
|
158
|
+
resp.raise_for_status()
|
|
159
|
+
return ent_validator.Run(**resp.json())
|
|
160
|
+
except ValidationError as e:
|
|
161
|
+
logging_utility.error("Validation error: %s", e.json())
|
|
162
|
+
raise ValueError(f"Validation error: {e}")
|
|
163
|
+
except httpx.HTTPStatusError as e:
|
|
164
|
+
logging_utility.error("HTTP error updating run metadata: %s", str(e))
|
|
165
|
+
raise
|
|
166
|
+
except Exception as e:
|
|
167
|
+
logging_utility.error("Unexpected error updating run metadata: %s", str(e))
|
|
168
|
+
raise
|
|
169
|
+
|
|
151
170
|
def update_run_status(self, run_id: str, new_status: str) -> ent_validator.Run:
|
|
152
171
|
"""
|
|
153
172
|
Update the status of a run.
|
|
@@ -609,18 +628,17 @@ class RunsClient(BaseAPIClient):
|
|
|
609
628
|
t.join()
|
|
610
629
|
|
|
611
630
|
# ------------------------------------------------------------
|
|
612
|
-
#
|
|
631
|
+
# List all runs by thread_id
|
|
613
632
|
# ------------------------------------------------------------
|
|
614
|
-
def
|
|
615
|
-
self, limit: int = 20, order: str = "asc"
|
|
633
|
+
def list_runs(
|
|
634
|
+
self, thread_id: str, limit: int = 20, order: str = "asc"
|
|
616
635
|
) -> ent_validator.RunListResponse:
|
|
617
636
|
params = {"limit": limit, "order": order if order in ("asc", "desc") else "asc"}
|
|
618
|
-
resp = self.client.get("/v1/runs", params=params)
|
|
637
|
+
resp = self.client.get(f"/v1/threads/{thread_id}/runs", params=params)
|
|
619
638
|
resp.raise_for_status()
|
|
620
639
|
payload = resp.json()
|
|
621
640
|
if isinstance(payload, dict) and "data" in payload:
|
|
622
641
|
return ent_validator.RunListResponse(**payload)
|
|
623
|
-
# legacy fallback: wrap raw list
|
|
624
642
|
runs = [ent_validator.Run(**item) for item in payload]
|
|
625
643
|
return ent_validator.RunListResponse(
|
|
626
644
|
object="list",
|
|
@@ -630,15 +648,19 @@ class RunsClient(BaseAPIClient):
|
|
|
630
648
|
has_more=False,
|
|
631
649
|
)
|
|
632
650
|
|
|
633
|
-
|
|
634
|
-
|
|
651
|
+
# ------------------------------------------------------------
|
|
652
|
+
# List all runs by user
|
|
653
|
+
# ------------------------------------------------------------
|
|
654
|
+
def list_all_runs(
|
|
655
|
+
self, limit: int = 20, order: str = "asc"
|
|
635
656
|
) -> ent_validator.RunListResponse:
|
|
636
657
|
params = {"limit": limit, "order": order if order in ("asc", "desc") else "asc"}
|
|
637
|
-
resp = self.client.get(
|
|
658
|
+
resp = self.client.get("/v1/runs", params=params)
|
|
638
659
|
resp.raise_for_status()
|
|
639
660
|
payload = resp.json()
|
|
640
661
|
if isinstance(payload, dict) and "data" in payload:
|
|
641
662
|
return ent_validator.RunListResponse(**payload)
|
|
663
|
+
# legacy fallback: wrap raw list
|
|
642
664
|
runs = [ent_validator.Run(**item) for item in payload]
|
|
643
665
|
return ent_validator.RunListResponse(
|
|
644
666
|
object="list",
|
|
@@ -647,153 +669,3 @@ class RunsClient(BaseAPIClient):
|
|
|
647
669
|
last_id=runs[-1].id if runs else None,
|
|
648
670
|
has_more=False,
|
|
649
671
|
)
|
|
650
|
-
|
|
651
|
-
def list_runs(self, limit: int = 20, order: str = "asc") -> List[ent_validator.Run]:
|
|
652
|
-
# soft-deprecate in logs if you want
|
|
653
|
-
env = self.list_runs_enveloped(limit=limit, order=order)
|
|
654
|
-
return list(env.data)
|
|
655
|
-
|
|
656
|
-
def list_runs_for_thread(
|
|
657
|
-
self, thread_id: str, limit: int = 20, order: str = "asc"
|
|
658
|
-
) -> List[ent_validator.Run]:
|
|
659
|
-
env = self.list_runs_for_thread_enveloped(
|
|
660
|
-
thread_id=thread_id, limit=limit, order=order
|
|
661
|
-
)
|
|
662
|
-
return list(env.data)
|
|
663
|
-
|
|
664
|
-
def list_runsX(
|
|
665
|
-
self, limit: int = 20, order: str = "asc"
|
|
666
|
-
) -> List[ent_validator.Run]:
|
|
667
|
-
|
|
668
|
-
logging_utility.info("Listing runs with limit: %d, order: %s", limit, order)
|
|
669
|
-
params = {"limit": limit, "order": order if order in ("asc", "desc") else "asc"}
|
|
670
|
-
try:
|
|
671
|
-
resp = self.client.get("/v1/runs", params=params)
|
|
672
|
-
resp.raise_for_status()
|
|
673
|
-
payload = resp.json()
|
|
674
|
-
|
|
675
|
-
# Preferred: envelope
|
|
676
|
-
if isinstance(payload, dict) and "data" in payload:
|
|
677
|
-
env = ent_validator.RunListResponse(**payload)
|
|
678
|
-
logging_utility.info("Retrieved %d runs", len(env.data))
|
|
679
|
-
return list(env.data)
|
|
680
|
-
|
|
681
|
-
# Legacy: raw list of dicts
|
|
682
|
-
runs = [ent_validator.Run(**item) for item in payload]
|
|
683
|
-
logging_utility.info("Retrieved %d runs (legacy)", len(runs))
|
|
684
|
-
return runs
|
|
685
|
-
|
|
686
|
-
except ValidationError as e:
|
|
687
|
-
logging_utility.error("Validation error: %s", e.json())
|
|
688
|
-
raise ValueError(f"Validation error: {e}")
|
|
689
|
-
except httpx.HTTPStatusError as e:
|
|
690
|
-
logging_utility.error("HTTP error occurred while listing runs: %s", str(e))
|
|
691
|
-
raise
|
|
692
|
-
except Exception as e:
|
|
693
|
-
logging_utility.error("An error occurred while listing runs: %s", str(e))
|
|
694
|
-
raise
|
|
695
|
-
|
|
696
|
-
def list_runs_with_metaX(
|
|
697
|
-
self, limit: int = 20, order: str = "asc"
|
|
698
|
-
) -> Tuple[List[ent_validator.Run], Optional[str], Optional[str], bool]:
|
|
699
|
-
"""
|
|
700
|
-
Returns (runs, first_id, last_id, has_more).
|
|
701
|
-
"""
|
|
702
|
-
logging_utility.info("Listing runs (with meta) limit=%d order=%s", limit, order)
|
|
703
|
-
params = {"limit": limit, "order": order if order in ("asc", "desc") else "asc"}
|
|
704
|
-
try:
|
|
705
|
-
resp = self.client.get("/v1/runs", params=params)
|
|
706
|
-
resp.raise_for_status()
|
|
707
|
-
payload = resp.json()
|
|
708
|
-
|
|
709
|
-
if isinstance(payload, dict) and "data" in payload:
|
|
710
|
-
env = ent_validator.RunListResponse(**payload)
|
|
711
|
-
return list(env.data), env.first_id, env.last_id, env.has_more
|
|
712
|
-
|
|
713
|
-
# Legacy fallback: compute minimal meta
|
|
714
|
-
runs = [ent_validator.Run(**item) for item in payload]
|
|
715
|
-
first_id = runs[0].id if runs else None
|
|
716
|
-
last_id = runs[-1].id if runs else None
|
|
717
|
-
return runs, first_id, last_id, False
|
|
718
|
-
|
|
719
|
-
except ValidationError as e:
|
|
720
|
-
logging_utility.error("Validation error: %s", e.json())
|
|
721
|
-
raise ValueError(f"Validation error: {e}")
|
|
722
|
-
except httpx.HTTPStatusError as e:
|
|
723
|
-
logging_utility.error("HTTP error occurred while listing runs: %s", str(e))
|
|
724
|
-
raise
|
|
725
|
-
except Exception as e:
|
|
726
|
-
logging_utility.error("An error occurred while listing runs: %s", str(e))
|
|
727
|
-
raise
|
|
728
|
-
|
|
729
|
-
def list_runs_for_threadX(
|
|
730
|
-
self, thread_id: str, limit: int = 20, order: str = "asc"
|
|
731
|
-
) -> List[ent_validator.Run]:
|
|
732
|
-
logging_utility.info(
|
|
733
|
-
"Listing runs for thread_id=%s (limit=%d, order=%s)",
|
|
734
|
-
thread_id,
|
|
735
|
-
limit,
|
|
736
|
-
order,
|
|
737
|
-
)
|
|
738
|
-
params = {"limit": limit, "order": order if order in ("asc", "desc") else "asc"}
|
|
739
|
-
try:
|
|
740
|
-
resp = self.client.get(f"/v1/threads/{thread_id}/runs", params=params)
|
|
741
|
-
resp.raise_for_status()
|
|
742
|
-
payload = resp.json()
|
|
743
|
-
|
|
744
|
-
if isinstance(payload, dict) and "data" in payload:
|
|
745
|
-
env = ent_validator.RunListResponse(**payload)
|
|
746
|
-
logging_utility.info(
|
|
747
|
-
"Retrieved %d runs for thread %s", len(env.data), thread_id
|
|
748
|
-
)
|
|
749
|
-
return list(env.data)
|
|
750
|
-
|
|
751
|
-
runs = [ent_validator.Run(**item) for item in payload]
|
|
752
|
-
logging_utility.info(
|
|
753
|
-
"Retrieved %d runs (legacy) for thread %s", len(runs), thread_id
|
|
754
|
-
)
|
|
755
|
-
return runs
|
|
756
|
-
|
|
757
|
-
except ValidationError as e:
|
|
758
|
-
logging_utility.error("Validation error: %s", e.json())
|
|
759
|
-
raise ValueError(f"Validation error: {e}")
|
|
760
|
-
except httpx.HTTPStatusError as e:
|
|
761
|
-
logging_utility.error("HTTP error listing runs for thread: %s", str(e))
|
|
762
|
-
raise
|
|
763
|
-
except Exception as e:
|
|
764
|
-
logging_utility.error("Error listing runs for thread: %s", str(e))
|
|
765
|
-
raise
|
|
766
|
-
|
|
767
|
-
def list_runs_for_thread_with_metaX(
|
|
768
|
-
self, thread_id: str, limit: int = 20, order: str = "asc"
|
|
769
|
-
) -> Tuple[List[ent_validator.Run], Optional[str], Optional[str], bool]:
|
|
770
|
-
logging_utility.info(
|
|
771
|
-
"Listing runs for thread_id=%s (with meta) limit=%d order=%s",
|
|
772
|
-
thread_id,
|
|
773
|
-
limit,
|
|
774
|
-
order,
|
|
775
|
-
)
|
|
776
|
-
params = {"limit": limit, "order": order if order in ("asc", "desc") else "asc"}
|
|
777
|
-
try:
|
|
778
|
-
resp = self.client.get(f"/v1/threads/{thread_id}/runs", params=params)
|
|
779
|
-
resp.raise_for_status()
|
|
780
|
-
payload = resp.json()
|
|
781
|
-
|
|
782
|
-
if isinstance(payload, dict) and "data" in payload:
|
|
783
|
-
env = ent_validator.RunListResponse(**payload)
|
|
784
|
-
return list(env.data), env.first_id, env.last_id, env.has_more
|
|
785
|
-
|
|
786
|
-
runs = [ent_validator.Run(**item) for item in payload]
|
|
787
|
-
first_id = runs[0].id if runs else None
|
|
788
|
-
last_id = runs[-1].id if runs else None
|
|
789
|
-
return runs, first_id, last_id, False
|
|
790
|
-
|
|
791
|
-
except ValidationError as e:
|
|
792
|
-
logging_utility.error("Validation error: %s", e.json())
|
|
793
|
-
raise ValueError(f"Validation error: {e}")
|
|
794
|
-
except httpx.HTTPStatusError as e:
|
|
795
|
-
logging_utility.error("HTTP error listing runs for thread: %s", str(e))
|
|
796
|
-
raise
|
|
797
|
-
except Exception as e:
|
|
798
|
-
logging_utility.error("Error listing runs for thread: %s", str(e))
|
|
799
|
-
raise
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: projectdavid
|
|
3
|
-
Version: 1.34.
|
|
3
|
+
Version: 1.34.4
|
|
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
|
|
@@ -15,7 +15,7 @@ projectdavid/clients/file_search.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
15
15
|
projectdavid/clients/files_client.py,sha256=XkIDzbQFGDrd88taf0Kouc_4YJOPIYEHiIyWYLKDofI,15581
|
|
16
16
|
projectdavid/clients/inference_client.py,sha256=xz4ACPv5Tkis604QxO5mJX1inH_TGDfQP-31geETYpE,6609
|
|
17
17
|
projectdavid/clients/messages_client.py,sha256=-tUubr5f62nLER6BxVY3ihp3vn3pnZH-ceigvQRSlYs,16825
|
|
18
|
-
projectdavid/clients/runs.py,sha256=
|
|
18
|
+
projectdavid/clients/runs.py,sha256=lW2gYkMEfiddZYvsEMkdmbb2MFRP6rUpdkKG_020iy0,26772
|
|
19
19
|
projectdavid/clients/synchronous_inference_wrapper.py,sha256=qh94rtNlLqgIxiA_ZbQ1ncOwQTi9aBj5os3sMExLh4E,7070
|
|
20
20
|
projectdavid/clients/threads_client.py,sha256=9RshJD09kfYxfarTysQz_Bwbv4XxQaHQXhCLRMdaWcI,7392
|
|
21
21
|
projectdavid/clients/tools_client.py,sha256=GkCVOmwpAoPqVt6aYmH0G1HIFha3iEwR9IIf9teR0j8,11487
|
|
@@ -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.34.
|
|
41
|
-
projectdavid-1.34.
|
|
42
|
-
projectdavid-1.34.
|
|
43
|
-
projectdavid-1.34.
|
|
44
|
-
projectdavid-1.34.
|
|
40
|
+
projectdavid-1.34.4.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
|
|
41
|
+
projectdavid-1.34.4.dist-info/METADATA,sha256=DptMF63609KaYskIGlnnmpyCFrvK0jGkfBCxXCP2ImI,11555
|
|
42
|
+
projectdavid-1.34.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
projectdavid-1.34.4.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
|
|
44
|
+
projectdavid-1.34.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|