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

@@ -153,18 +153,21 @@ class MessagesClient(BaseAPIClient):
153
153
  raise
154
154
 
155
155
  def list_messages(
156
- self, thread_id: str, limit: int = 20, order: str = "asc"
157
- ) -> List[Dict[str, Any]]:
156
+ self,
157
+ thread_id: str,
158
+ limit: int = 20,
159
+ order: str = "asc",
160
+ ) -> ent_validator.MessagesList:
158
161
  """
159
- List messages for a given thread.
162
+ Fetch messages for a thread and return an OpenAI-style envelope.
160
163
 
161
164
  Args:
162
- thread_id (str): The thread ID.
163
- limit (int): Maximum number of messages to retrieve.
164
- order (str): Order of messages ('asc' or 'desc').
165
+ thread_id (str): Target thread ID.
166
+ limit (int): Max messages to fetch.
167
+ order (str): 'asc' or 'desc'.
165
168
 
166
169
  Returns:
167
- List[Dict[str, Any]]: A list of messages as dictionaries.
170
+ MessagesList: Wrapper containing .data[], .first_id, .last_id, .has_more …
168
171
  """
169
172
  logging_utility.info(
170
173
  "Listing messages for thread_id: %s, limit: %d, order: %s",
@@ -178,24 +181,19 @@ class MessagesClient(BaseAPIClient):
178
181
  f"/v1/threads/{thread_id}/messages", params=params
179
182
  )
180
183
  response.raise_for_status()
181
- messages = response.json()
182
- validated_messages = [
183
- ent_validator.MessageRead(**message) for message in messages
184
- ]
185
- logging_utility.info("Retrieved %d messages", len(validated_messages))
186
- return [message.dict() for message in validated_messages]
184
+
185
+ envelope = ent_validator.MessagesList(**response.json())
186
+ logging_utility.info("Retrieved %d messages", len(envelope.data))
187
+ return envelope
188
+
187
189
  except ValidationError as e:
188
190
  logging_utility.error("Validation error: %s", e.json())
189
- raise ValueError(f"Validation error: {e}")
191
+ raise ValueError(f"Validation error: {e}") from e
190
192
  except httpx.HTTPStatusError as e:
191
- logging_utility.error(
192
- "HTTP error occurred while listing messages: %s", str(e)
193
- )
193
+ logging_utility.error("HTTP error while listing messages: %s", str(e))
194
194
  raise
195
195
  except Exception as e:
196
- logging_utility.error(
197
- "An error occurred while listing messages: %s", str(e)
198
- )
196
+ logging_utility.error("Unexpected error while listing messages: %s", str(e))
199
197
  raise
200
198
 
201
199
  def get_formatted_messages(
@@ -294,32 +292,19 @@ class MessagesClient(BaseAPIClient):
294
292
  logging_utility.error("An error occurred: %s", str(e))
295
293
  raise RuntimeError(f"An error occurred: {str(e)}")
296
294
 
297
- def delete_message(self, message_id: str) -> Dict[str, Any]:
298
- """
299
- Delete a message by its ID.
300
-
301
- Args:
302
- message_id (str): The ID of the message.
303
-
304
- Returns:
305
- Dict[str, Any]: The deletion result.
306
- """
295
+ def delete_message(self, message_id: str) -> ent_validator.MessageDeleted:
296
+ """Delete a message and return deletion envelope."""
307
297
  logging_utility.info("Deleting message with id: %s", message_id)
308
298
  try:
309
299
  response = self.client.delete(f"/v1/messages/{message_id}")
310
300
  response.raise_for_status()
311
- result = response.json()
312
- logging_utility.info("Message deleted successfully")
313
- return result
301
+ return ent_validator.MessageDeleted(**response.json())
302
+
314
303
  except httpx.HTTPStatusError as e:
315
- logging_utility.error(
316
- "HTTP error occurred while deleting message: %s", str(e)
317
- )
304
+ logging_utility.error("HTTP error while deleting message: %s", str(e))
318
305
  raise
319
306
  except Exception as e:
320
- logging_utility.error(
321
- "An error occurred while deleting message: %s", str(e)
322
- )
307
+ logging_utility.error("Unexpected error while deleting message: %s", str(e))
323
308
  raise
324
309
 
325
310
  def save_assistant_message_chunk(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid
3
- Version: 1.33.31
3
+ Version: 1.33.33
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.8
23
+ Requires-Dist: projectdavid_common==0.17.11
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
@@ -14,7 +14,7 @@ projectdavid/clients/file_processor.py,sha256=vstT-X-F-QI4mvSxpLfXJBLSol0PuPtPdS
14
14
  projectdavid/clients/file_search.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  projectdavid/clients/files_client.py,sha256=XkIDzbQFGDrd88taf0Kouc_4YJOPIYEHiIyWYLKDofI,15581
16
16
  projectdavid/clients/inference_client.py,sha256=xz4ACPv5Tkis604QxO5mJX1inH_TGDfQP-31geETYpE,6609
17
- projectdavid/clients/messages_client.py,sha256=467xeIt3VYs6cG8-bl-eDRi_auWOPmfd5tSJDmQSJUI,17232
17
+ projectdavid/clients/messages_client.py,sha256=-tUubr5f62nLER6BxVY3ihp3vn3pnZH-ceigvQRSlYs,16825
18
18
  projectdavid/clients/runs.py,sha256=-fXOq5L9w2efDPmZkNxb0s2yjl6oN0XN4_aLXqaeceo,25270
19
19
  projectdavid/clients/synchronous_inference_wrapper.py,sha256=qh94rtNlLqgIxiA_ZbQ1ncOwQTi9aBj5os3sMExLh4E,7070
20
20
  projectdavid/clients/threads_client.py,sha256=9RshJD09kfYxfarTysQz_Bwbv4XxQaHQXhCLRMdaWcI,7392
@@ -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.31.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
41
- projectdavid-1.33.31.dist-info/METADATA,sha256=oBvbSuyUeF1QBgEVkW2ctBBvtrbS3_d18LIZGnQNbLc,11555
42
- projectdavid-1.33.31.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
43
- projectdavid-1.33.31.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
44
- projectdavid-1.33.31.dist-info/RECORD,,
40
+ projectdavid-1.33.33.dist-info/licenses/LICENSE,sha256=_8yjiEGttpS284BkfhXxfERqTRZW_tUaHiBB0GTJTMg,4563
41
+ projectdavid-1.33.33.dist-info/METADATA,sha256=N2yfT44Bx7pK-A5d3dRcOAAoOmSFEHS4SMMUvEAsuf0,11556
42
+ projectdavid-1.33.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
43
+ projectdavid-1.33.33.dist-info/top_level.txt,sha256=kil8GU4s7qYRfNnzGnFHhZnSNRSxgNG-J4HLgQMmMtw,13
44
+ projectdavid-1.33.33.dist-info/RECORD,,