cortexdbai 0.2.1__tar.gz → 0.2.3__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.1 → cortexdbai-0.2.3}/PKG-INFO +2 -1
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/__init__.py +116 -116
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/v1/__init__.py +60 -60
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/v1/client.py +701 -608
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/v1/exceptions.py +92 -92
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/pyproject.toml +66 -65
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/.gitignore +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/README.md +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/client.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/exceptions.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/models.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/cortexdb/py.typed +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/tests/__init__.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/tests/conftest.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.3}/tests/test_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cortexdbai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
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
|
|
@@ -25,6 +25,7 @@ Classifier: Typing :: Typed
|
|
|
25
25
|
Requires-Python: >=3.9
|
|
26
26
|
Requires-Dist: httpx>=0.24
|
|
27
27
|
Requires-Dist: pydantic>=2.0
|
|
28
|
+
Requires-Dist: requests>=2.31
|
|
28
29
|
Requires-Dist: tenacity>=8.0
|
|
29
30
|
Provides-Extra: async
|
|
30
31
|
Requires-Dist: httpx[http2]; extra == 'async'
|
|
@@ -1,116 +1,116 @@
|
|
|
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.
|
|
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
|
-
]
|
|
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.3"
|
|
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
|
+
]
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
"""CortexDB v1 Python SDK.
|
|
2
|
-
|
|
3
|
-
The v1 API surface uses scope paths (``org:foo/user:bar``), the
|
|
4
|
-
``ExperienceEnvelope`` shape on write, the stratified ``StratifiedPack``
|
|
5
|
-
shape on recall, and PASETO/JWT bearer auth (with ``X-Cortex-Actor``
|
|
6
|
-
required on every request).
|
|
7
|
-
|
|
8
|
-
Quick start:
|
|
9
|
-
|
|
10
|
-
.. code-block:: python
|
|
11
|
-
|
|
12
|
-
from cortexdb.v1 import V1Client
|
|
13
|
-
|
|
14
|
-
client = V1Client(
|
|
15
|
-
api_url="https://api.cortexdb.ai", # or http://localhost:3142 for v1 surface
|
|
16
|
-
actor="user:alice",
|
|
17
|
-
bearer="eyJ...", # PASETO v4 public or JWT (RS256/ES256)
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# Ingest
|
|
21
|
-
client.experience_bulk("org:initech/user:alice", [
|
|
22
|
-
{"role": "user", "text": "I love coffee in the morning"},
|
|
23
|
-
])
|
|
24
|
-
|
|
25
|
-
# Recall
|
|
26
|
-
pack = client.recall("org:initech/user:alice", query="What does Alice drink?")
|
|
27
|
-
|
|
28
|
-
# Answer
|
|
29
|
-
out = client.answer(
|
|
30
|
-
"org:initech/user:alice",
|
|
31
|
-
question="What does Alice drink?",
|
|
32
|
-
question_type="single-session-user",
|
|
33
|
-
)
|
|
34
|
-
print(out["answer"])
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
from cortexdb.v1.client import AsyncV1Client, V1Client
|
|
38
|
-
from cortexdb.v1.exceptions import (
|
|
39
|
-
V1APIError,
|
|
40
|
-
V1AuthError,
|
|
41
|
-
V1ConnectionError,
|
|
42
|
-
V1Error,
|
|
43
|
-
V1NotConfiguredError,
|
|
44
|
-
V1PolicyDeniedError,
|
|
45
|
-
V1RateLimitError,
|
|
46
|
-
V1TimeoutError,
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
__all__ = [
|
|
50
|
-
"V1Client",
|
|
51
|
-
"AsyncV1Client",
|
|
52
|
-
"V1Error",
|
|
53
|
-
"V1APIError",
|
|
54
|
-
"V1AuthError",
|
|
55
|
-
"V1ConnectionError",
|
|
56
|
-
"V1TimeoutError",
|
|
57
|
-
"V1RateLimitError",
|
|
58
|
-
"V1NotConfiguredError",
|
|
59
|
-
"V1PolicyDeniedError",
|
|
60
|
-
]
|
|
1
|
+
"""CortexDB v1 Python SDK.
|
|
2
|
+
|
|
3
|
+
The v1 API surface uses scope paths (``org:foo/user:bar``), the
|
|
4
|
+
``ExperienceEnvelope`` shape on write, the stratified ``StratifiedPack``
|
|
5
|
+
shape on recall, and PASETO/JWT bearer auth (with ``X-Cortex-Actor``
|
|
6
|
+
required on every request).
|
|
7
|
+
|
|
8
|
+
Quick start:
|
|
9
|
+
|
|
10
|
+
.. code-block:: python
|
|
11
|
+
|
|
12
|
+
from cortexdb.v1 import V1Client
|
|
13
|
+
|
|
14
|
+
client = V1Client(
|
|
15
|
+
api_url="https://api.cortexdb.ai", # or http://localhost:3142 for v1 surface
|
|
16
|
+
actor="user:alice",
|
|
17
|
+
bearer="eyJ...", # PASETO v4 public or JWT (RS256/ES256)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Ingest
|
|
21
|
+
client.experience_bulk("org:initech/user:alice", [
|
|
22
|
+
{"role": "user", "text": "I love coffee in the morning"},
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
# Recall
|
|
26
|
+
pack = client.recall("org:initech/user:alice", query="What does Alice drink?")
|
|
27
|
+
|
|
28
|
+
# Answer
|
|
29
|
+
out = client.answer(
|
|
30
|
+
"org:initech/user:alice",
|
|
31
|
+
question="What does Alice drink?",
|
|
32
|
+
question_type="single-session-user",
|
|
33
|
+
)
|
|
34
|
+
print(out["answer"])
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
from cortexdb.v1.client import AsyncV1Client, V1Client
|
|
38
|
+
from cortexdb.v1.exceptions import (
|
|
39
|
+
V1APIError,
|
|
40
|
+
V1AuthError,
|
|
41
|
+
V1ConnectionError,
|
|
42
|
+
V1Error,
|
|
43
|
+
V1NotConfiguredError,
|
|
44
|
+
V1PolicyDeniedError,
|
|
45
|
+
V1RateLimitError,
|
|
46
|
+
V1TimeoutError,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"V1Client",
|
|
51
|
+
"AsyncV1Client",
|
|
52
|
+
"V1Error",
|
|
53
|
+
"V1APIError",
|
|
54
|
+
"V1AuthError",
|
|
55
|
+
"V1ConnectionError",
|
|
56
|
+
"V1TimeoutError",
|
|
57
|
+
"V1RateLimitError",
|
|
58
|
+
"V1NotConfiguredError",
|
|
59
|
+
"V1PolicyDeniedError",
|
|
60
|
+
]
|