acontext 0.1.8__tar.gz → 0.1.9__tar.gz

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.
Files changed (38) hide show
  1. {acontext-0.1.8 → acontext-0.1.9}/PKG-INFO +1 -1
  2. {acontext-0.1.8 → acontext-0.1.9}/pyproject.toml +1 -1
  3. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/async_sessions.py +88 -1
  4. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/sessions.py +88 -1
  5. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/session.py +4 -0
  6. {acontext-0.1.8 → acontext-0.1.9}/README.md +0 -0
  7. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/__init__.py +0 -0
  8. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/_constants.py +0 -0
  9. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/_utils.py +0 -0
  10. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/__init__.py +0 -0
  11. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/base.py +0 -0
  12. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/disk.py +0 -0
  13. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/prompts.py +0 -0
  14. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/sandbox.py +0 -0
  15. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/skill.py +0 -0
  16. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/agent/text_editor.py +0 -0
  17. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/async_client.py +0 -0
  18. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/client.py +0 -0
  19. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/client_types.py +0 -0
  20. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/errors.py +0 -0
  21. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/messages.py +0 -0
  22. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/py.typed +0 -0
  23. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/__init__.py +0 -0
  24. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/async_disks.py +0 -0
  25. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/async_sandboxes.py +0 -0
  26. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/async_skills.py +0 -0
  27. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/async_users.py +0 -0
  28. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/disks.py +0 -0
  29. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/sandboxes.py +0 -0
  30. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/skills.py +0 -0
  31. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/resources/users.py +0 -0
  32. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/__init__.py +0 -0
  33. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/common.py +0 -0
  34. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/disk.py +0 -0
  35. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/sandbox.py +0 -0
  36. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/skill.py +0 -0
  37. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/types/user.py +0 -0
  38. {acontext-0.1.8 → acontext-0.1.9}/src/acontext/uploads.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: acontext
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Python SDK for the Acontext API
5
5
  Keywords: acontext,sdk,client,api
6
6
  Requires-Dist: httpx>=0.28.1
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "acontext"
3
- version = "0.1.8"
3
+ version = "0.1.9"
4
4
  description = "Python SDK for the Acontext API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -224,6 +224,7 @@ class AsyncSessionsAPI:
224
224
  *,
225
225
  blob: MessageBlob,
226
226
  format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
227
+ meta: dict[str, Any] | None = None,
227
228
  file_field: str | None = None,
228
229
  file: (
229
230
  FileUpload
@@ -238,12 +239,15 @@ class AsyncSessionsAPI:
238
239
  session_id: The UUID of the session.
239
240
  blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
240
241
  format: The format of the message blob. Defaults to "openai".
242
+ meta: Optional user-provided metadata for the message. This metadata is stored
243
+ separately from the message content and can be retrieved via get_messages().metas
244
+ or updated via patch_message_meta(). Works with all formats.
241
245
  file_field: The field name for file upload. Only used when format is "acontext".
242
246
  Required if file is provided. Defaults to None.
243
247
  file: Optional file upload. Only used when format is "acontext". Defaults to None.
244
248
 
245
249
  Returns:
246
- The created Message object.
250
+ The created Message object. The msg.meta field contains only user-provided metadata.
247
251
 
248
252
  Raises:
249
253
  ValueError: If format is invalid, file/file_field provided for non-acontext format,
@@ -264,6 +268,9 @@ class AsyncSessionsAPI:
264
268
  payload: dict[str, Any] = {
265
269
  "format": format,
266
270
  }
271
+ if meta is not None:
272
+ payload["meta"] = meta
273
+
267
274
  if format == "acontext":
268
275
  if isinstance(blob, Mapping):
269
276
  payload["blob"] = blob
@@ -412,3 +419,83 @@ class AsyncSessionsAPI:
412
419
  "GET", f"/session/{session_id}/observing_status"
413
420
  )
414
421
  return MessageObservingStatus.model_validate(data)
422
+
423
+ async def patch_message_meta(
424
+ self,
425
+ session_id: str,
426
+ message_id: str,
427
+ *,
428
+ meta: dict[str, Any],
429
+ ) -> dict[str, Any]:
430
+ """Update message metadata using patch semantics.
431
+
432
+ Only updates keys present in the meta dict. Existing keys not in the request
433
+ are preserved. To delete a key, pass None as its value.
434
+
435
+ Args:
436
+ session_id: The UUID of the session.
437
+ message_id: The UUID of the message.
438
+ meta: Dictionary of metadata keys to add, update, or delete.
439
+ Pass None as a value to delete that key.
440
+
441
+ Returns:
442
+ The complete user metadata after the patch operation.
443
+
444
+ Example:
445
+ >>> # Add/update keys
446
+ >>> updated = await client.sessions.patch_message_meta(
447
+ ... session_id, message_id,
448
+ ... meta={"status": "processed", "score": 0.95}
449
+ ... )
450
+ >>> # Delete a key
451
+ >>> updated = await client.sessions.patch_message_meta(
452
+ ... session_id, message_id,
453
+ ... meta={"old_key": None} # Deletes "old_key"
454
+ ... )
455
+ """
456
+ payload = {"meta": meta}
457
+ data = await self._requester.request(
458
+ "PATCH",
459
+ f"/session/{session_id}/messages/{message_id}/meta",
460
+ json_data=payload,
461
+ )
462
+ return data.get("meta", {}) # type: ignore
463
+
464
+ async def patch_configs(
465
+ self,
466
+ session_id: str,
467
+ *,
468
+ configs: dict[str, Any],
469
+ ) -> dict[str, Any]:
470
+ """Update session configs using patch semantics.
471
+
472
+ Only updates keys present in the configs dict. Existing keys not in the request
473
+ are preserved. To delete a key, pass None as its value.
474
+
475
+ Args:
476
+ session_id: The UUID of the session.
477
+ configs: Dictionary of config keys to add, update, or delete.
478
+ Pass None as a value to delete that key.
479
+
480
+ Returns:
481
+ The complete configs after the patch operation.
482
+
483
+ Example:
484
+ >>> # Add/update keys
485
+ >>> updated = await client.sessions.patch_configs(
486
+ ... session_id,
487
+ ... configs={"agent": "bot2", "temperature": 0.8}
488
+ ... )
489
+ >>> # Delete a key
490
+ >>> updated = await client.sessions.patch_configs(
491
+ ... session_id,
492
+ ... configs={"old_key": None} # Deletes "old_key"
493
+ ... )
494
+ """
495
+ payload = {"configs": configs}
496
+ data = await self._requester.request(
497
+ "PATCH",
498
+ f"/session/{session_id}/configs",
499
+ json_data=payload,
500
+ )
501
+ return data.get("configs", {}) # type: ignore
@@ -224,6 +224,7 @@ class SessionsAPI:
224
224
  *,
225
225
  blob: MessageBlob,
226
226
  format: Literal["acontext", "openai", "anthropic", "gemini"] = "openai",
227
+ meta: dict[str, Any] | None = None,
227
228
  file_field: str | None = None,
228
229
  file: (
229
230
  FileUpload
@@ -238,12 +239,15 @@ class SessionsAPI:
238
239
  session_id: The UUID of the session.
239
240
  blob: The message blob in Acontext, OpenAI, Anthropic, or Gemini format.
240
241
  format: The format of the message blob. Defaults to "openai".
242
+ meta: Optional user-provided metadata for the message. This metadata is stored
243
+ separately from the message content and can be retrieved via get_messages().metas
244
+ or updated via patch_message_meta(). Works with all formats.
241
245
  file_field: The field name for file upload. Only used when format is "acontext".
242
246
  Required if file is provided. Defaults to None.
243
247
  file: Optional file upload. Only used when format is "acontext". Defaults to None.
244
248
 
245
249
  Returns:
246
- The created Message object.
250
+ The created Message object. The msg.meta field contains only user-provided metadata.
247
251
 
248
252
  Raises:
249
253
  ValueError: If format is invalid, file/file_field provided for non-acontext format,
@@ -265,6 +269,9 @@ class SessionsAPI:
265
269
  payload: dict[str, Any] = {
266
270
  "format": format,
267
271
  }
272
+ if meta is not None:
273
+ payload["meta"] = meta
274
+
268
275
  if format == "acontext":
269
276
  if isinstance(blob, Mapping):
270
277
  payload["blob"] = blob
@@ -406,3 +413,83 @@ class SessionsAPI:
406
413
  """
407
414
  data = self._requester.request("GET", f"/session/{session_id}/observing_status")
408
415
  return MessageObservingStatus.model_validate(data)
416
+
417
+ def patch_message_meta(
418
+ self,
419
+ session_id: str,
420
+ message_id: str,
421
+ *,
422
+ meta: dict[str, Any],
423
+ ) -> dict[str, Any]:
424
+ """Update message metadata using patch semantics.
425
+
426
+ Only updates keys present in the meta dict. Existing keys not in the request
427
+ are preserved. To delete a key, pass None as its value.
428
+
429
+ Args:
430
+ session_id: The UUID of the session.
431
+ message_id: The UUID of the message.
432
+ meta: Dictionary of metadata keys to add, update, or delete.
433
+ Pass None as a value to delete that key.
434
+
435
+ Returns:
436
+ The complete user metadata after the patch operation.
437
+
438
+ Example:
439
+ >>> # Add/update keys
440
+ >>> updated = client.sessions.patch_message_meta(
441
+ ... session_id, message_id,
442
+ ... meta={"status": "processed", "score": 0.95}
443
+ ... )
444
+ >>> # Delete a key
445
+ >>> updated = client.sessions.patch_message_meta(
446
+ ... session_id, message_id,
447
+ ... meta={"old_key": None} # Deletes "old_key"
448
+ ... )
449
+ """
450
+ payload = {"meta": meta}
451
+ data = self._requester.request(
452
+ "PATCH",
453
+ f"/session/{session_id}/messages/{message_id}/meta",
454
+ json_data=payload,
455
+ )
456
+ return data.get("meta", {}) # type: ignore
457
+
458
+ def patch_configs(
459
+ self,
460
+ session_id: str,
461
+ *,
462
+ configs: dict[str, Any],
463
+ ) -> dict[str, Any]:
464
+ """Update session configs using patch semantics.
465
+
466
+ Only updates keys present in the configs dict. Existing keys not in the request
467
+ are preserved. To delete a key, pass None as its value.
468
+
469
+ Args:
470
+ session_id: The UUID of the session.
471
+ configs: Dictionary of config keys to add, update, or delete.
472
+ Pass None as a value to delete that key.
473
+
474
+ Returns:
475
+ The complete configs after the patch operation.
476
+
477
+ Example:
478
+ >>> # Add/update keys
479
+ >>> updated = client.sessions.patch_configs(
480
+ ... session_id,
481
+ ... configs={"agent": "bot2", "temperature": 0.8}
482
+ ... )
483
+ >>> # Delete a key
484
+ >>> updated = client.sessions.patch_configs(
485
+ ... session_id,
486
+ ... configs={"old_key": None} # Deletes "old_key"
487
+ ... )
488
+ """
489
+ payload = {"configs": configs}
490
+ data = self._requester.request(
491
+ "PATCH",
492
+ f"/session/{session_id}/configs",
493
+ json_data=payload,
494
+ )
495
+ return data.get("configs", {}) # type: ignore
@@ -245,6 +245,10 @@ class GetMessagesOutput(BaseModel):
245
245
  ...,
246
246
  description="List of message UUIDs corresponding to each item in the same order",
247
247
  )
248
+ metas: list[dict[str, Any]] = Field(
249
+ default_factory=list,
250
+ description="List of user-provided metadata for each message (same order as items/ids)",
251
+ )
248
252
  next_cursor: str | None = Field(None, description="Cursor for pagination")
249
253
  has_more: bool = Field(..., description="Whether there are more items")
250
254
  this_time_tokens: int = Field(
File without changes
File without changes