projectdavid 1.34.11__py3-none-any.whl → 1.34.13__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 +27 -17
- {projectdavid-1.34.11.dist-info → projectdavid-1.34.13.dist-info}/METADATA +2 -2
- {projectdavid-1.34.11.dist-info → projectdavid-1.34.13.dist-info}/RECORD +6 -6
- {projectdavid-1.34.11.dist-info → projectdavid-1.34.13.dist-info}/WHEEL +0 -0
- {projectdavid-1.34.11.dist-info → projectdavid-1.34.13.dist-info}/licenses/LICENSE +0 -0
- {projectdavid-1.34.11.dist-info → projectdavid-1.34.13.dist-info}/top_level.txt +0 -0
projectdavid/clients/runs.py
CHANGED
|
@@ -7,7 +7,7 @@ from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
|
7
7
|
import httpx
|
|
8
8
|
import requests
|
|
9
9
|
from projectdavid_common import UtilsInterface, ValidationInterface
|
|
10
|
-
from projectdavid_common.validation import StatusEnum
|
|
10
|
+
from projectdavid_common.validation import StatusEnum, TruncationStrategy
|
|
11
11
|
from pydantic import ValidationError
|
|
12
12
|
from sseclient import SSEClient
|
|
13
13
|
|
|
@@ -43,58 +43,68 @@ class RunsClient(BaseAPIClient):
|
|
|
43
43
|
thread_id: str,
|
|
44
44
|
instructions: str = "",
|
|
45
45
|
meta_data: Optional[Dict[str, Any]] = None,
|
|
46
|
+
*,
|
|
47
|
+
# new optional knobs; keep backwards compatible
|
|
48
|
+
model: Optional[str] = None,
|
|
49
|
+
response_format: str = "text",
|
|
50
|
+
tool_choice: Optional[str] = None, # allow None in signature, fix below
|
|
51
|
+
temperature: float = 1.0,
|
|
52
|
+
top_p: float = 1.0,
|
|
46
53
|
) -> ent_validator.Run:
|
|
47
54
|
"""
|
|
48
55
|
Create a run. The server injects user_id from the API key.
|
|
49
56
|
We normalize all timestamp fields to epoch ints (or None).
|
|
50
57
|
"""
|
|
51
|
-
#
|
|
58
|
+
# ── Coerce client-friendly Nones into schema-acceptable values ─────────
|
|
59
|
+
meta_data = meta_data or {} # schema expects Dict
|
|
60
|
+
tool_choice = tool_choice or "none" # schema expects str
|
|
61
|
+
model = model or "gpt-4" # defer to schema default or override at callsite
|
|
62
|
+
|
|
63
|
+
now = int(time.time())
|
|
64
|
+
|
|
52
65
|
run_payload = ent_validator.RunCreate(
|
|
53
66
|
id=UtilsInterface.IdentifierService.generate_run_id(),
|
|
54
|
-
user_id=None,
|
|
67
|
+
user_id=None, # server fills this
|
|
55
68
|
assistant_id=assistant_id,
|
|
56
69
|
thread_id=thread_id,
|
|
57
70
|
instructions=instructions,
|
|
58
71
|
meta_data=meta_data,
|
|
59
72
|
cancelled_at=None,
|
|
60
73
|
completed_at=None,
|
|
61
|
-
created_at=
|
|
62
|
-
expires_at=
|
|
74
|
+
created_at=now,
|
|
75
|
+
expires_at=now + 3600,
|
|
63
76
|
failed_at=None,
|
|
64
77
|
incomplete_details=None,
|
|
65
78
|
last_error=None,
|
|
66
79
|
max_completion_tokens=1000,
|
|
67
80
|
max_prompt_tokens=500,
|
|
68
|
-
model=
|
|
81
|
+
model=model, # ← no more hard-coded llama3.1
|
|
69
82
|
object="run",
|
|
70
83
|
parallel_tool_calls=False,
|
|
71
84
|
required_action=None,
|
|
72
|
-
response_format=
|
|
85
|
+
response_format=response_format,
|
|
73
86
|
started_at=None,
|
|
74
|
-
status=
|
|
75
|
-
|
|
87
|
+
status=ent_validator.RunStatus.pending,
|
|
88
|
+
# use schema enum; queued is also valid if you prefer
|
|
89
|
+
tool_choice=tool_choice,
|
|
76
90
|
tools=[],
|
|
77
|
-
truncation_strategy=
|
|
91
|
+
truncation_strategy=ent_validator.TruncationStrategy.auto,
|
|
78
92
|
usage=None,
|
|
79
|
-
temperature=
|
|
80
|
-
top_p=
|
|
93
|
+
temperature=temperature,
|
|
94
|
+
top_p=top_p,
|
|
81
95
|
tool_resources={},
|
|
82
96
|
)
|
|
83
97
|
|
|
84
98
|
logging_utility.info(
|
|
85
|
-
"Creating run for assistant_id=%s, thread_id=%s",
|
|
86
|
-
assistant_id,
|
|
87
|
-
thread_id,
|
|
99
|
+
"Creating run for assistant_id=%s, thread_id=%s", assistant_id, thread_id
|
|
88
100
|
)
|
|
89
101
|
logging_utility.debug("Run payload: %s", run_payload.model_dump())
|
|
90
102
|
|
|
91
103
|
try:
|
|
92
|
-
# Exclude None so we don't send unset fields
|
|
93
104
|
resp = self.client.post(
|
|
94
105
|
"/v1/runs", json=run_payload.model_dump(exclude_none=True)
|
|
95
106
|
)
|
|
96
107
|
resp.raise_for_status()
|
|
97
|
-
|
|
98
108
|
run_out = ent_validator.Run(**resp.json())
|
|
99
109
|
logging_utility.info("Run created successfully: %s", run_out.id)
|
|
100
110
|
return run_out
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: projectdavid
|
|
3
|
-
Version: 1.34.
|
|
3
|
+
Version: 1.34.13
|
|
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 @@ Requires-Dist: pydantic<3.0,>=2.0
|
|
|
20
20
|
Requires-Dist: python-dotenv<2.0,>=1.0.1
|
|
21
21
|
Requires-Dist: aiofiles<25.0,>=23.2.1
|
|
22
22
|
Requires-Dist: ollama<0.5.0,>=0.4.4
|
|
23
|
-
Requires-Dist: projectdavid_common==0.17.
|
|
23
|
+
Requires-Dist: projectdavid_common==0.17.19
|
|
24
24
|
Requires-Dist: qdrant-client<2.0.0,>=1.0.0
|
|
25
25
|
Requires-Dist: pdfplumber<0.12.0,>=0.11.0
|
|
26
26
|
Requires-Dist: validators<0.35.0,>=0.29.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=GnaOoIGzDHNNOF0iJUGYIYPJSrbdKbFn5oXuugV6R-w,26497
|
|
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.13.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
|
|
41
|
+
projectdavid-1.34.13.dist-info/METADATA,sha256=bXBdvuh-QI4boyjdbb8-VWPX2H2EHZN1D4cFjtPKgiM,11556
|
|
42
|
+
projectdavid-1.34.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
projectdavid-1.34.13.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
|
|
44
|
+
projectdavid-1.34.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|