cortexdbai 0.2.2__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.2 → cortexdbai-0.2.3}/PKG-INFO +2 -1
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/__init__.py +116 -116
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/v1/client.py +13 -3
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/pyproject.toml +66 -65
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/.gitignore +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/README.md +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/client.py +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/exceptions.py +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/models.py +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/py.typed +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/v1/__init__.py +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/cortexdb/v1/exceptions.py +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/tests/__init__.py +0 -0
- {cortexdbai-0.2.2 → cortexdbai-0.2.3}/tests/conftest.py +0 -0
- {cortexdbai-0.2.2 → 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
|
+
]
|
|
@@ -289,11 +289,17 @@ class V1Client:
|
|
|
289
289
|
query: Optional[str] = None,
|
|
290
290
|
view: str = "holistic",
|
|
291
291
|
include: Optional[Sequence[str]] = None,
|
|
292
|
-
diagnostics: str = "
|
|
292
|
+
diagnostics: str = "none",
|
|
293
293
|
budgets: Optional[Mapping[str, Any]] = None,
|
|
294
294
|
temporal: Optional[Mapping[str, Any]] = None,
|
|
295
295
|
) -> dict:
|
|
296
|
-
"""``POST /v1/recall`` — returns a ``StratifiedPack``.
|
|
296
|
+
"""``POST /v1/recall`` — returns a ``StratifiedPack``.
|
|
297
|
+
|
|
298
|
+
``diagnostics`` defaults to ``"none"`` so free-tier tokens — which
|
|
299
|
+
do not carry the ``diagnostics.read`` capability — succeed on the
|
|
300
|
+
first call. Pass ``diagnostics="summary"`` (or ``"full"``) when
|
|
301
|
+
you hold the elevated capability and want pipeline provenance.
|
|
302
|
+
"""
|
|
297
303
|
body: dict = {"scope": scope, "view": view, "diagnostics": diagnostics}
|
|
298
304
|
if query:
|
|
299
305
|
body["query"] = query
|
|
@@ -632,8 +638,12 @@ class AsyncV1Client:
|
|
|
632
638
|
*,
|
|
633
639
|
query: Optional[str] = None,
|
|
634
640
|
view: str = "holistic",
|
|
641
|
+
diagnostics: str = "none",
|
|
635
642
|
) -> dict:
|
|
636
|
-
|
|
643
|
+
"""``POST /v1/recall``. ``diagnostics`` defaults to ``"none"`` so
|
|
644
|
+
free-tier tokens succeed on the first call (no ``diagnostics.read``
|
|
645
|
+
capability required)."""
|
|
646
|
+
body: dict = {"scope": scope, "view": view, "diagnostics": diagnostics}
|
|
637
647
|
if query:
|
|
638
648
|
body["query"] = query
|
|
639
649
|
return await self._post("/v1/recall", body)
|
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "cortexdbai"
|
|
7
|
-
version = "0.2.
|
|
8
|
-
description = "The Long-Term Memory Layer for AI Systems"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
license = "Apache-2.0"
|
|
11
|
-
requires-python = ">=3.9"
|
|
12
|
-
authors = [
|
|
13
|
-
{ name = "Prashant Malik", email = "prashant@cortexdb.ai" },
|
|
14
|
-
]
|
|
15
|
-
keywords = ["ai", "memory", "llm", "knowledge-graph", "event-sourcing", "cortexdb"]
|
|
16
|
-
classifiers = [
|
|
17
|
-
"Development Status :: 3 - Alpha",
|
|
18
|
-
"Intended Audience :: Developers",
|
|
19
|
-
"License :: OSI Approved :: Apache Software License",
|
|
20
|
-
"Programming Language :: Python :: 3",
|
|
21
|
-
"Programming Language :: Python :: 3.9",
|
|
22
|
-
"Programming Language :: Python :: 3.10",
|
|
23
|
-
"Programming Language :: Python :: 3.11",
|
|
24
|
-
"Programming Language :: Python :: 3.12",
|
|
25
|
-
"Programming Language :: Python :: 3.13",
|
|
26
|
-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
|
-
"Topic :: Database",
|
|
28
|
-
"Typing :: Typed",
|
|
29
|
-
]
|
|
30
|
-
dependencies = [
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"pytest
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cortexdbai"
|
|
7
|
+
version = "0.2.3"
|
|
8
|
+
description = "The Long-Term Memory Layer for AI Systems"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Prashant Malik", email = "prashant@cortexdb.ai" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ai", "memory", "llm", "knowledge-graph", "event-sourcing", "cortexdb"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: Apache Software License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
|
+
"Topic :: Database",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"requests>=2.31",
|
|
32
|
+
"httpx>=0.24",
|
|
33
|
+
"pydantic>=2.0",
|
|
34
|
+
"tenacity>=8.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
async = [
|
|
39
|
+
"httpx[http2]",
|
|
40
|
+
]
|
|
41
|
+
dev = [
|
|
42
|
+
"pytest>=8.0",
|
|
43
|
+
"pytest-asyncio>=0.23",
|
|
44
|
+
"ruff>=0.4",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://cortexdb.ai"
|
|
49
|
+
Documentation = "https://docs.cortexdb.ai"
|
|
50
|
+
Repository = "https://github.com/cortexdb/cortexdb"
|
|
51
|
+
Issues = "https://github.com/cortexdb/cortexdb/issues"
|
|
52
|
+
Changelog = "https://github.com/cortexdb/cortexdb/blob/main/CHANGELOG.md"
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
packages = ["cortexdb"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
target-version = "py39"
|
|
59
|
+
line-length = 100
|
|
60
|
+
|
|
61
|
+
[tool.ruff.lint]
|
|
62
|
+
select = ["E", "F", "W", "I", "N", "UP", "B", "A", "SIM", "TCH"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
asyncio_mode = "auto"
|
|
66
|
+
testpaths = ["tests"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|