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

@@ -43,58 +43,77 @@ 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,
53
+ # ↓ NEW: optional; only sent if provided
54
+ truncation_strategy: Optional[ent_validator.TruncationStrategy] = None,
46
55
  ) -> ent_validator.Run:
47
56
  """
48
57
  Create a run. The server injects user_id from the API key.
49
58
  We normalize all timestamp fields to epoch ints (or None).
50
59
  """
51
- # Build the Pydantic payload with epoch-normalized timestamps
60
+ # ── Coerce client-friendly Nones into schema-acceptable values ─────────
61
+ meta_data = meta_data or {} # schema expects Dict
62
+ tool_choice = tool_choice or "none" # schema expects str
63
+ model = model or "gpt-4" # defer to schema default or override at callsite
64
+
65
+ now = int(time.time())
66
+
52
67
  run_payload = ent_validator.RunCreate(
53
68
  id=UtilsInterface.IdentifierService.generate_run_id(),
54
- user_id=None,
69
+ user_id=None, # server fills this
55
70
  assistant_id=assistant_id,
56
71
  thread_id=thread_id,
57
72
  instructions=instructions,
58
73
  meta_data=meta_data,
59
74
  cancelled_at=None,
60
75
  completed_at=None,
61
- created_at=int(time.time()),
62
- expires_at=int(time.time() + 3600),
76
+ created_at=now,
77
+ expires_at=now + 3600,
63
78
  failed_at=None,
64
79
  incomplete_details=None,
65
80
  last_error=None,
66
81
  max_completion_tokens=1000,
67
82
  max_prompt_tokens=500,
68
- model="llama3.1",
83
+ model=model, # ← no more hard-coded llama3.1
69
84
  object="run",
70
85
  parallel_tool_calls=False,
71
86
  required_action=None,
72
- response_format="text",
87
+ response_format=response_format,
73
88
  started_at=None,
74
- status=StatusEnum.queued,
75
- tool_choice=None,
89
+ status=ent_validator.RunStatus.pending,
90
+ # use schema enum; queued is also valid if you prefer
91
+ tool_choice=tool_choice,
76
92
  tools=[],
77
- truncation_strategy=TruncationStrategy.auto,
93
+ # NOTE: do NOT set truncation_strategy here; only if provided below
78
94
  usage=None,
79
- temperature=1,
80
- top_p=1,
95
+ temperature=temperature,
96
+ top_p=top_p,
81
97
  tool_resources={},
82
98
  )
83
99
 
100
+ # If caller explicitly provided truncation_strategy, set it; else omit so DB default fires
101
+ if truncation_strategy is not None:
102
+ run_payload.truncation_strategy = truncation_strategy
103
+
84
104
  logging_utility.info(
85
- "Creating run for assistant_id=%s, thread_id=%s",
86
- assistant_id,
87
- thread_id,
105
+ "Creating run for assistant_id=%s, thread_id=%s", assistant_id, thread_id
88
106
  )
89
107
  logging_utility.debug("Run payload: %s", run_payload.model_dump())
90
108
 
91
109
  try:
92
- # Exclude None so we don't send unset fields
93
- resp = self.client.post(
94
- "/v1/runs", json=run_payload.model_dump(exclude_none=True)
95
- )
96
- resp.raise_for_status()
110
+ # Build dict; if truncation_strategy wasn't provided, drop it so DB default applies
111
+ payload_dict = run_payload.model_dump(exclude_none=True)
112
+ if truncation_strategy is None:
113
+ payload_dict.pop("truncation_strategy", None)
97
114
 
115
+ resp = self.client.post("/v1/runs", json=payload_dict)
116
+ resp.raise_for_status()
98
117
  run_out = ent_validator.Run(**resp.json())
99
118
  logging_utility.info("Run created successfully: %s", run_out.id)
100
119
  return run_out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid
3
- Version: 1.34.12
3
+ Version: 1.35.0
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.19
23
+ Requires-Dist: projectdavid_common==0.18.0
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=f6EgowOuKUg_SDlM1YcvSReOFy33WD6qkw_DLg3r7fk,25869
18
+ projectdavid/clients/runs.py,sha256=D6FimyLKhw6yKjOBdlcO78sqJ2i-5F05IGc-ZnW39Q0,27060
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.12.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
41
- projectdavid-1.34.12.dist-info/METADATA,sha256=XxJu3-LkQFKxyptEuF7XHExdLqfP-4J0mqo7bCjmkzY,11556
42
- projectdavid-1.34.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
43
- projectdavid-1.34.12.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
44
- projectdavid-1.34.12.dist-info/RECORD,,
40
+ projectdavid-1.35.0.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
41
+ projectdavid-1.35.0.dist-info/METADATA,sha256=2Fg0fIvfxMvATqoesvhYOc5eCEYhSa7FmSr49z2beXI,11554
42
+ projectdavid-1.35.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
43
+ projectdavid-1.35.0.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
44
+ projectdavid-1.35.0.dist-info/RECORD,,