cortexdbai 0.3.1__tar.gz → 0.3.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortexdbai
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: The Long-Term Memory Layer for AI Systems
5
5
  Project-URL: Homepage, https://cortexdb.ai
6
6
  Project-URL: Documentation, https://docs.cortexdb.ai
@@ -49,7 +49,7 @@ from cortexdb import v1 # the explicit submodule namespace
49
49
  Cortex = V1Client
50
50
  AsyncCortex = AsyncV1Client
51
51
 
52
- __version__ = "0.3.1"
52
+ __version__ = "0.3.2"
53
53
  __all__ = [
54
54
  # Clients (preferred top-level names)
55
55
  "Cortex",
@@ -62,6 +62,22 @@ def _build_headers(
62
62
  return h
63
63
 
64
64
 
65
+ def _capture_sdk_error(exc: BaseException) -> None:
66
+ """Best-effort client-side error tracking (observability plan, Phase 6).
67
+
68
+ If the host application uses Sentry, forward SDK transport/API errors to
69
+ it so failures users hit are visible to the operator. This is a NO-OP when
70
+ ``sentry_sdk`` isn't installed or isn't initialized — the SDK never
71
+ initializes Sentry itself (the app owns that decision and the DSN)."""
72
+ try:
73
+ import sentry_sdk
74
+
75
+ if sentry_sdk.Hub.current.client is not None:
76
+ sentry_sdk.capture_exception(exc)
77
+ except Exception:
78
+ pass
79
+
80
+
65
81
  def _raise_for_response(status: int, text: str) -> None:
66
82
  """If the response is non-2xx, raise the most-specific V1APIError
67
83
  subclass derived from the v1 error envelope. Otherwise return None."""
@@ -71,7 +87,9 @@ def _raise_for_response(status: int, text: str) -> None:
71
87
  body = json.loads(text) if text else {}
72
88
  except json.JSONDecodeError:
73
89
  body = {"error_code": "UNKNOWN", "message": text[:500]}
74
- raise V1APIError.from_response(status, body)
90
+ err = V1APIError.from_response(status, body)
91
+ _capture_sdk_error(err)
92
+ raise err
75
93
 
76
94
 
77
95
  def _envelope(
@@ -260,11 +278,18 @@ class V1Client:
260
278
  self,
261
279
  scope: str,
262
280
  items: Iterable[Mapping[str, Any]],
281
+ *,
282
+ wait: Optional[str] = None,
263
283
  ) -> dict:
264
284
  """``POST /v1/experience/bulk`` — accepts up to 1000 envelopes per
265
285
  request. ``items`` is a sequence of dicts with at least ``text``
266
286
  (or ``json_data``) plus optional ``role`` / ``observed_at`` /
267
- ``labels`` / ``idempotency_key`` keys."""
287
+ ``labels`` / ``idempotency_key`` keys.
288
+
289
+ ``wait`` turns the batch into a barrier: pass ``"indexed"`` (or
290
+ ``"consolidated"`` etc.) to block until every accepted event reaches
291
+ that stage before returning — the batch analogue of
292
+ :meth:`experience`'s ``wait``, ideal for bulk-ingest-then-recall."""
268
293
  envelopes = [
269
294
  _envelope(
270
295
  scope=str(item.get("scope", scope)),
@@ -278,7 +303,8 @@ class V1Client:
278
303
  )
279
304
  for item in items
280
305
  ]
281
- return self._post("/v1/experience/bulk", {"items": envelopes})
306
+ path = "/v1/experience/bulk" + (f"?wait={wait}" if wait else "")
307
+ return self._post(path, {"items": envelopes})
282
308
 
283
309
  # ── recall + answer ───────────────────────────────────────────────
284
310
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cortexdbai"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  description = "The Long-Term Memory Layer for AI Systems"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
File without changes
File without changes
File without changes
File without changes