cortexdbai 0.2.4__tar.gz → 0.3.0__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.
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/PKG-INFO +3 -5
- cortexdbai-0.3.0/cortexdb/__init__.py +71 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/pyproject.toml +12 -6
- cortexdbai-0.2.4/cortexdb/__init__.py +0 -116
- cortexdbai-0.2.4/cortexdb/client.py +0 -1103
- cortexdbai-0.2.4/cortexdb/exceptions.py +0 -69
- cortexdbai-0.2.4/cortexdb/models.py +0 -446
- cortexdbai-0.2.4/tests/conftest.py +0 -39
- cortexdbai-0.2.4/tests/test_client.py +0 -659
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/.gitignore +0 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/README.md +0 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/cortexdb/py.typed +0 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/cortexdb/v1/__init__.py +0 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/cortexdb/v1/client.py +0 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/cortexdb/v1/exceptions.py +0 -0
- {cortexdbai-0.2.4 → cortexdbai-0.3.0}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cortexdbai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -10,11 +10,9 @@ Project-URL: Changelog, https://github.com/cortexdb/cortexdb/blob/main/CHANGELOG
|
|
|
10
10
|
Author-email: Prashant Malik <prashant@cortexdb.ai>
|
|
11
11
|
License-Expression: Apache-2.0
|
|
12
12
|
Keywords: ai,cortexdb,event-sourcing,knowledge-graph,llm,memory
|
|
13
|
-
Classifier: Development Status ::
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -22,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
22
20
|
Classifier: Topic :: Database
|
|
23
21
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
22
|
Classifier: Typing :: Typed
|
|
25
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.10
|
|
26
24
|
Requires-Dist: httpx>=0.24
|
|
27
25
|
Requires-Dist: pydantic>=2.0
|
|
28
26
|
Requires-Dist: requests>=2.31
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""CortexDB Python SDK — the long-term memory layer for AI systems.
|
|
2
|
+
|
|
3
|
+
The SDK is a thin HTTP client over the v1 API surface that cortexdb
|
|
4
|
+
exposes by default on port 3141. The top-level :class:`Cortex` class
|
|
5
|
+
(alias :class:`V1Client`) is what you should reach for.
|
|
6
|
+
|
|
7
|
+
Quick start::
|
|
8
|
+
|
|
9
|
+
from cortexdb import Cortex
|
|
10
|
+
|
|
11
|
+
# Local docker run with no auth (CORTEX_API_KEY unset on the server):
|
|
12
|
+
with Cortex("http://localhost:3141") as c:
|
|
13
|
+
c.experience("ws:demo", text="Priya at Acme signed for 200 seats.")
|
|
14
|
+
pack = c.recall("ws:demo", query="How many seats did Acme sign for?")
|
|
15
|
+
print(pack)
|
|
16
|
+
|
|
17
|
+
# Hosted / multi-tenant deployment with PASETO bearer + actor header:
|
|
18
|
+
with Cortex(
|
|
19
|
+
"https://api.cortexdb.ai",
|
|
20
|
+
actor="user:alice",
|
|
21
|
+
bearer="eyJ...",
|
|
22
|
+
) as c:
|
|
23
|
+
out = c.answer(
|
|
24
|
+
"org:initech/user:alice",
|
|
25
|
+
question="What did Alice say about coffee?",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
Versions ≤ 0.2.x exposed a separate ``cortexdb.Cortex`` class targeting
|
|
29
|
+
the legacy ``/v1/remember`` endpoints. That surface was retired in 0.3.0
|
|
30
|
+
because the cortexdb binary's public port now only serves the v1 API;
|
|
31
|
+
the legacy endpoints survive only as an internal bench-compat helper.
|
|
32
|
+
If you need them, pin ``cortexdbai<0.3``.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from cortexdb.v1 import V1Client, AsyncV1Client
|
|
36
|
+
from cortexdb.v1.exceptions import (
|
|
37
|
+
V1APIError,
|
|
38
|
+
V1AuthError,
|
|
39
|
+
V1ConnectionError,
|
|
40
|
+
V1Error,
|
|
41
|
+
V1NotConfiguredError,
|
|
42
|
+
V1PolicyDeniedError,
|
|
43
|
+
V1RateLimitError,
|
|
44
|
+
V1TimeoutError,
|
|
45
|
+
)
|
|
46
|
+
from cortexdb import v1 # the explicit submodule namespace
|
|
47
|
+
|
|
48
|
+
# Ergonomic top-level aliases. New code can write either form.
|
|
49
|
+
Cortex = V1Client
|
|
50
|
+
AsyncCortex = AsyncV1Client
|
|
51
|
+
|
|
52
|
+
__version__ = "0.3.0"
|
|
53
|
+
__all__ = [
|
|
54
|
+
# Clients (preferred top-level names)
|
|
55
|
+
"Cortex",
|
|
56
|
+
"AsyncCortex",
|
|
57
|
+
# Explicit v1 names (identical classes, kept for code that pinned them)
|
|
58
|
+
"V1Client",
|
|
59
|
+
"AsyncV1Client",
|
|
60
|
+
# Submodule
|
|
61
|
+
"v1",
|
|
62
|
+
# Exceptions
|
|
63
|
+
"V1Error",
|
|
64
|
+
"V1APIError",
|
|
65
|
+
"V1AuthError",
|
|
66
|
+
"V1ConnectionError",
|
|
67
|
+
"V1TimeoutError",
|
|
68
|
+
"V1RateLimitError",
|
|
69
|
+
"V1NotConfiguredError",
|
|
70
|
+
"V1PolicyDeniedError",
|
|
71
|
+
]
|
|
@@ -4,21 +4,27 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cortexdbai"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "The Long-Term Memory Layer for AI Systems"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
11
|
-
|
|
11
|
+
# 3.10+: the v1 module uses PEP 604 unions (`str | None`) in TypedDict
|
|
12
|
+
# field annotations, which Python 3.9 cannot evaluate at class-definition
|
|
13
|
+
# time even with `from __future__ import annotations`. Python 3.9 hit
|
|
14
|
+
# end-of-life on 2025-10-31. Declaring >=3.10 means `pip install
|
|
15
|
+
# cortexdbai` on 3.9 fails immediately with a clear "requires Python
|
|
16
|
+
# 3.10+" error from pip — not a silent install followed by an obscure
|
|
17
|
+
# `TypeError: Unable to evaluate type annotation 'str | None'` on the
|
|
18
|
+
# first import.
|
|
19
|
+
requires-python = ">=3.10"
|
|
12
20
|
authors = [
|
|
13
21
|
{ name = "Prashant Malik", email = "prashant@cortexdb.ai" },
|
|
14
22
|
]
|
|
15
23
|
keywords = ["ai", "memory", "llm", "knowledge-graph", "event-sourcing", "cortexdb"]
|
|
16
24
|
classifiers = [
|
|
17
|
-
"Development Status ::
|
|
25
|
+
"Development Status :: 4 - Beta",
|
|
18
26
|
"Intended Audience :: Developers",
|
|
19
|
-
"License :: OSI Approved :: Apache Software License",
|
|
20
27
|
"Programming Language :: Python :: 3",
|
|
21
|
-
"Programming Language :: Python :: 3.9",
|
|
22
28
|
"Programming Language :: Python :: 3.10",
|
|
23
29
|
"Programming Language :: Python :: 3.11",
|
|
24
30
|
"Programming Language :: Python :: 3.12",
|
|
@@ -55,7 +61,7 @@ Changelog = "https://github.com/cortexdb/cortexdb/blob/main/CHANGELOG.md"
|
|
|
55
61
|
packages = ["cortexdb"]
|
|
56
62
|
|
|
57
63
|
[tool.ruff]
|
|
58
|
-
target-version = "
|
|
64
|
+
target-version = "py310"
|
|
59
65
|
line-length = 100
|
|
60
66
|
|
|
61
67
|
[tool.ruff.lint]
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"""CortexDB Python SDK — The Long-Term Memory Layer for AI Systems.
|
|
2
|
-
|
|
3
|
-
Two API surfaces are available:
|
|
4
|
-
|
|
5
|
-
* The top-level :class:`Cortex` / :class:`AsyncCortex` clients target the
|
|
6
|
-
legacy v0 endpoints (``/v1/remember``, ``/v1/recall``, ``/v1/answer``
|
|
7
|
-
with the v0 request shape) served on port 3141 by default. Used by
|
|
8
|
-
existing integrations.
|
|
9
|
-
* The :mod:`cortexdb.v1` submodule targets the new v1 surface
|
|
10
|
-
(``/v1/experience``, stratified-pack recall, layered ``/v1/answer``,
|
|
11
|
-
``/v1/episodes``, ``/v1/beliefs``, ``/v1/understanding``,
|
|
12
|
-
``/v1/admin/layers/stats``, ``/v1/audit``, ``/v1/forget``) served on
|
|
13
|
-
port 3142 in dual-port deployments, with PASETO/JWT bearer auth.
|
|
14
|
-
New apps should use :class:`cortexdb.v1.V1Client`.
|
|
15
|
-
|
|
16
|
-
Quick start (v1):
|
|
17
|
-
|
|
18
|
-
.. code-block:: python
|
|
19
|
-
|
|
20
|
-
from cortexdb.v1 import V1Client
|
|
21
|
-
|
|
22
|
-
with V1Client("https://api.cortexdb.ai", actor="user:alice", bearer=token) as c:
|
|
23
|
-
c.experience_bulk("org:initech/user:alice", [{"text": "hello"}])
|
|
24
|
-
out = c.answer("org:initech/user:alice", "what did I say?",
|
|
25
|
-
question_type="single-session-user")
|
|
26
|
-
print(out["answer"])
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
from cortexdb.client import AsyncCortex, Cortex
|
|
30
|
-
from cortexdb import v1 # re-export the v1 namespace
|
|
31
|
-
from cortexdb.exceptions import (
|
|
32
|
-
CortexAPIError,
|
|
33
|
-
CortexAuthError,
|
|
34
|
-
CortexConnectionError,
|
|
35
|
-
CortexError,
|
|
36
|
-
CortexRateLimitError,
|
|
37
|
-
CortexTimeoutError,
|
|
38
|
-
)
|
|
39
|
-
from cortexdb.models import (
|
|
40
|
-
Actor,
|
|
41
|
-
ActorType,
|
|
42
|
-
BlobRef,
|
|
43
|
-
ContentType,
|
|
44
|
-
EntityRef,
|
|
45
|
-
EntityRelationship,
|
|
46
|
-
EntityResponse,
|
|
47
|
-
Episode,
|
|
48
|
-
EpisodeBrief,
|
|
49
|
-
EpisodeType,
|
|
50
|
-
ForgetRequest,
|
|
51
|
-
ForgetResponse,
|
|
52
|
-
HealthResponse,
|
|
53
|
-
IngestEpisodeRequest,
|
|
54
|
-
IngestEpisodeResponse,
|
|
55
|
-
LinkResponse,
|
|
56
|
-
ListEpisodesResponse,
|
|
57
|
-
MetricsResponse,
|
|
58
|
-
ProcessingStatus,
|
|
59
|
-
RecallMemory,
|
|
60
|
-
RecallRequest,
|
|
61
|
-
RecallResponse,
|
|
62
|
-
RememberRequest,
|
|
63
|
-
RememberResponse,
|
|
64
|
-
SearchResponse,
|
|
65
|
-
Source,
|
|
66
|
-
Visibility,
|
|
67
|
-
VisibilityLevel,
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
__version__ = "0.2.4"
|
|
71
|
-
__all__ = [
|
|
72
|
-
# v1 surface (recommended for new apps)
|
|
73
|
-
"v1",
|
|
74
|
-
# Legacy v0 clients
|
|
75
|
-
"Cortex",
|
|
76
|
-
"AsyncCortex",
|
|
77
|
-
# Enums
|
|
78
|
-
"EpisodeType",
|
|
79
|
-
"ActorType",
|
|
80
|
-
"VisibilityLevel",
|
|
81
|
-
"ContentType",
|
|
82
|
-
"ProcessingStatus",
|
|
83
|
-
# Core models
|
|
84
|
-
"Actor",
|
|
85
|
-
"Source",
|
|
86
|
-
"Visibility",
|
|
87
|
-
"EntityRef",
|
|
88
|
-
"Episode",
|
|
89
|
-
"BlobRef",
|
|
90
|
-
"RecallMemory",
|
|
91
|
-
# Request models
|
|
92
|
-
"IngestEpisodeRequest",
|
|
93
|
-
"RememberRequest",
|
|
94
|
-
"RecallRequest",
|
|
95
|
-
"ForgetRequest",
|
|
96
|
-
# Response models
|
|
97
|
-
"IngestEpisodeResponse",
|
|
98
|
-
"RememberResponse",
|
|
99
|
-
"RecallResponse",
|
|
100
|
-
"ForgetResponse",
|
|
101
|
-
"ListEpisodesResponse",
|
|
102
|
-
"HealthResponse",
|
|
103
|
-
"MetricsResponse",
|
|
104
|
-
"EntityResponse",
|
|
105
|
-
"EntityRelationship",
|
|
106
|
-
"EpisodeBrief",
|
|
107
|
-
"LinkResponse",
|
|
108
|
-
"SearchResponse",
|
|
109
|
-
# Exceptions
|
|
110
|
-
"CortexError",
|
|
111
|
-
"CortexAPIError",
|
|
112
|
-
"CortexConnectionError",
|
|
113
|
-
"CortexTimeoutError",
|
|
114
|
-
"CortexAuthError",
|
|
115
|
-
"CortexRateLimitError",
|
|
116
|
-
]
|