cortexdbai 0.4.2__tar.gz → 0.4.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.4.2 → cortexdbai-0.4.3}/.gitignore +3 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/PKG-INFO +49 -1
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/README.md +48 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/__init__.py +71 -71
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/ag2/__init__.py +21 -21
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/agno/__init__.py +13 -13
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/langchain/__init__.py +29 -29
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/langchain/tools.py +121 -121
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/v1/client.py +96 -8
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/pyproject.toml +186 -186
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/ag2/agent.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/ag2/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/agno/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/agno/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/autogen/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/autogen/agent.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/autogen/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/beeai/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/beeai/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/beeai/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/camel/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/camel/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/camel/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/controlflow/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/controlflow/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/crewai/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/crewai/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/crewai/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/deepinfra/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/deepinfra/config.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/deepinfra/embeddings.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/deepinfra/openai_compat.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/dify/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/dify/manifest.yaml +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/dify/tool.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/dspy/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/dspy/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/dspy/retriever.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/fireworks/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/fireworks/config.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/fireworks/embeddings.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/fireworks/openai_compat.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/flowise/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/flowise/node.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/google_adk/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/google_adk/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/groq/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/groq/config.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/groq/embeddings.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/groq/openai_compat.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/hermes/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/hermes/provider.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/instructor/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/instructor/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/langchain/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/langchain/retriever.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/langgraph/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/langgraph/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/letta/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/letta/storage.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/llamaindex/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/llamaindex/memory.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/nemo_guardrails/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/nemo_guardrails/actions.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/nemo_guardrails/knowledge_base.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/ollama/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/ollama/config.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/ollama/embeddings.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/openai_agents/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/openai_agents/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/prefect/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/prefect/blocks.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/prefect/tasks.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/pydanticai/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/pydanticai/dependencies.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/pydanticai/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/smolagents/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/smolagents/tools.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/temporal/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/temporal/activities.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/temporal/interceptor.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/together/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/together/config.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/together/embeddings.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/together/openai_compat.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/vllm/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/vllm/config.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/vllm/embeddings.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/integrations/vllm/openai_compat.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/py.typed +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/v1/__init__.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/cortexdb/v1/exceptions.py +0 -0
- {cortexdbai-0.4.2 → cortexdbai-0.4.3}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cortexdbai
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.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
|
|
@@ -234,6 +234,54 @@ with Cortex("http://localhost:3141") as c:
|
|
|
234
234
|
print(f"API error [{e.status_code}]: {e}")
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
+
## Integrations
|
|
238
|
+
|
|
239
|
+
Framework and provider adapters ship as optional extras of the same
|
|
240
|
+
`cortexdbai` package — there are no separate `cortexdb-<framework>` packages
|
|
241
|
+
to install. Pick an extra and import from `cortexdb.integrations.<submodule>`:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
pip install cortexdbai[langgraph] # or crewai, llamaindex, autogen, …
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from cortexdb.integrations.langgraph import CortexDBCheckpointer, cortexdb_memory_node
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Available extras (`pip install cortexdbai[<extra>]`):
|
|
252
|
+
|
|
253
|
+
| Extra | Import submodule |
|
|
254
|
+
|-------|------------------|
|
|
255
|
+
| `autogen` | `cortexdb.integrations.autogen` |
|
|
256
|
+
| `beeai` | `cortexdb.integrations.beeai` |
|
|
257
|
+
| `camel` | `cortexdb.integrations.camel` |
|
|
258
|
+
| `controlflow` | `cortexdb.integrations.controlflow` |
|
|
259
|
+
| `crewai` | `cortexdb.integrations.crewai` |
|
|
260
|
+
| `dify` | `cortexdb.integrations.dify` |
|
|
261
|
+
| `dspy` | `cortexdb.integrations.dspy` |
|
|
262
|
+
| `flowise` | `cortexdb.integrations.flowise` |
|
|
263
|
+
| `google-adk` | `cortexdb.integrations.google_adk` |
|
|
264
|
+
| `hermes` | `cortexdb.integrations.hermes` |
|
|
265
|
+
| `instructor` | `cortexdb.integrations.instructor` |
|
|
266
|
+
| `langgraph` | `cortexdb.integrations.langgraph` |
|
|
267
|
+
| `letta` | `cortexdb.integrations.letta` |
|
|
268
|
+
| `llamaindex` | `cortexdb.integrations.llamaindex` |
|
|
269
|
+
| `nemo-guardrails` | `cortexdb.integrations.nemo_guardrails` |
|
|
270
|
+
| `openai-agents` | `cortexdb.integrations.openai_agents` |
|
|
271
|
+
| `prefect` | `cortexdb.integrations.prefect` |
|
|
272
|
+
| `pydanticai` | `cortexdb.integrations.pydanticai` |
|
|
273
|
+
| `smolagents` | `cortexdb.integrations.smolagents` |
|
|
274
|
+
| `temporal` | `cortexdb.integrations.temporal` |
|
|
275
|
+
| `langchain` | `cortexdb.integrations.langchain` |
|
|
276
|
+
| `ag2` | `cortexdb.integrations.ag2` |
|
|
277
|
+
| `agno` | `cortexdb.integrations.agno` |
|
|
278
|
+
| `groq` | `cortexdb.integrations.groq` |
|
|
279
|
+
| `fireworks` | `cortexdb.integrations.fireworks` |
|
|
280
|
+
| `together` | `cortexdb.integrations.together` |
|
|
281
|
+
| `deepinfra` | `cortexdb.integrations.deepinfra` |
|
|
282
|
+
| `ollama` | `cortexdb.integrations.ollama` |
|
|
283
|
+
| `vllm` | `cortexdb.integrations.vllm` |
|
|
284
|
+
|
|
237
285
|
## Constructor
|
|
238
286
|
|
|
239
287
|
| Parameter | Type | Default | Description |
|
|
@@ -121,6 +121,54 @@ with Cortex("http://localhost:3141") as c:
|
|
|
121
121
|
print(f"API error [{e.status_code}]: {e}")
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
## Integrations
|
|
125
|
+
|
|
126
|
+
Framework and provider adapters ship as optional extras of the same
|
|
127
|
+
`cortexdbai` package — there are no separate `cortexdb-<framework>` packages
|
|
128
|
+
to install. Pick an extra and import from `cortexdb.integrations.<submodule>`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install cortexdbai[langgraph] # or crewai, llamaindex, autogen, …
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from cortexdb.integrations.langgraph import CortexDBCheckpointer, cortexdb_memory_node
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Available extras (`pip install cortexdbai[<extra>]`):
|
|
139
|
+
|
|
140
|
+
| Extra | Import submodule |
|
|
141
|
+
|-------|------------------|
|
|
142
|
+
| `autogen` | `cortexdb.integrations.autogen` |
|
|
143
|
+
| `beeai` | `cortexdb.integrations.beeai` |
|
|
144
|
+
| `camel` | `cortexdb.integrations.camel` |
|
|
145
|
+
| `controlflow` | `cortexdb.integrations.controlflow` |
|
|
146
|
+
| `crewai` | `cortexdb.integrations.crewai` |
|
|
147
|
+
| `dify` | `cortexdb.integrations.dify` |
|
|
148
|
+
| `dspy` | `cortexdb.integrations.dspy` |
|
|
149
|
+
| `flowise` | `cortexdb.integrations.flowise` |
|
|
150
|
+
| `google-adk` | `cortexdb.integrations.google_adk` |
|
|
151
|
+
| `hermes` | `cortexdb.integrations.hermes` |
|
|
152
|
+
| `instructor` | `cortexdb.integrations.instructor` |
|
|
153
|
+
| `langgraph` | `cortexdb.integrations.langgraph` |
|
|
154
|
+
| `letta` | `cortexdb.integrations.letta` |
|
|
155
|
+
| `llamaindex` | `cortexdb.integrations.llamaindex` |
|
|
156
|
+
| `nemo-guardrails` | `cortexdb.integrations.nemo_guardrails` |
|
|
157
|
+
| `openai-agents` | `cortexdb.integrations.openai_agents` |
|
|
158
|
+
| `prefect` | `cortexdb.integrations.prefect` |
|
|
159
|
+
| `pydanticai` | `cortexdb.integrations.pydanticai` |
|
|
160
|
+
| `smolagents` | `cortexdb.integrations.smolagents` |
|
|
161
|
+
| `temporal` | `cortexdb.integrations.temporal` |
|
|
162
|
+
| `langchain` | `cortexdb.integrations.langchain` |
|
|
163
|
+
| `ag2` | `cortexdb.integrations.ag2` |
|
|
164
|
+
| `agno` | `cortexdb.integrations.agno` |
|
|
165
|
+
| `groq` | `cortexdb.integrations.groq` |
|
|
166
|
+
| `fireworks` | `cortexdb.integrations.fireworks` |
|
|
167
|
+
| `together` | `cortexdb.integrations.together` |
|
|
168
|
+
| `deepinfra` | `cortexdb.integrations.deepinfra` |
|
|
169
|
+
| `ollama` | `cortexdb.integrations.ollama` |
|
|
170
|
+
| `vllm` | `cortexdb.integrations.vllm` |
|
|
171
|
+
|
|
124
172
|
## Constructor
|
|
125
173
|
|
|
126
174
|
| Parameter | Type | Default | Description |
|
|
@@ -1,71 +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-v1.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.4.
|
|
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
|
-
]
|
|
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-v1.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.4.3"
|
|
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
|
+
]
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"""CortexDB integration for AG2 (successor to AutoGen).
|
|
2
|
-
|
|
3
|
-
Provides a memory-augmented agent mixin and callable tools that connect
|
|
4
|
-
AG2's multi-agent framework to CortexDB's long-term memory system.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from .agent import CortexDBAgent
|
|
8
|
-
from .tools import (
|
|
9
|
-
cortexdb_forget_fn,
|
|
10
|
-
cortexdb_search_fn,
|
|
11
|
-
cortexdb_store_fn,
|
|
12
|
-
register_cortexdb_tools,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
__all__ = [
|
|
16
|
-
"CortexDBAgent",
|
|
17
|
-
"cortexdb_search_fn",
|
|
18
|
-
"cortexdb_store_fn",
|
|
19
|
-
"cortexdb_forget_fn",
|
|
20
|
-
"register_cortexdb_tools",
|
|
21
|
-
]
|
|
1
|
+
"""CortexDB integration for AG2 (successor to AutoGen).
|
|
2
|
+
|
|
3
|
+
Provides a memory-augmented agent mixin and callable tools that connect
|
|
4
|
+
AG2's multi-agent framework to CortexDB's long-term memory system.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .agent import CortexDBAgent
|
|
8
|
+
from .tools import (
|
|
9
|
+
cortexdb_forget_fn,
|
|
10
|
+
cortexdb_search_fn,
|
|
11
|
+
cortexdb_store_fn,
|
|
12
|
+
register_cortexdb_tools,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"CortexDBAgent",
|
|
17
|
+
"cortexdb_search_fn",
|
|
18
|
+
"cortexdb_store_fn",
|
|
19
|
+
"cortexdb_forget_fn",
|
|
20
|
+
"register_cortexdb_tools",
|
|
21
|
+
]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"""CortexDB integration for Agno.
|
|
2
|
-
|
|
3
|
-
Provides a memory backend and agent tools that allow Agno agents
|
|
4
|
-
to use CortexDB as their long-term memory system.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from .memory import CortexDBMemory
|
|
8
|
-
from .tools import CortexDBTools
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"CortexDBMemory",
|
|
12
|
-
"CortexDBTools",
|
|
13
|
-
]
|
|
1
|
+
"""CortexDB integration for Agno.
|
|
2
|
+
|
|
3
|
+
Provides a memory backend and agent tools that allow Agno agents
|
|
4
|
+
to use CortexDB as their long-term memory system.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .memory import CortexDBMemory
|
|
8
|
+
from .tools import CortexDBTools
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"CortexDBMemory",
|
|
12
|
+
"CortexDBTools",
|
|
13
|
+
]
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"""CortexDB integration for LangChain.
|
|
2
|
-
|
|
3
|
-
Provides chat-message history, retrievers, and tools that connect LangChain
|
|
4
|
-
applications to CortexDB's long-term memory system.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from .memory import CortexDBChatMessageHistory
|
|
8
|
-
from .retriever import CortexDBRetriever
|
|
9
|
-
from .tools import (
|
|
10
|
-
CortexDBForgetTool,
|
|
11
|
-
CortexDBSearchTool,
|
|
12
|
-
CortexDBStoreTool,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
__all__ = [
|
|
16
|
-
"CortexDBChatMessageHistory",
|
|
17
|
-
"CortexDBRetriever",
|
|
18
|
-
"CortexDBForgetTool",
|
|
19
|
-
"CortexDBSearchTool",
|
|
20
|
-
"CortexDBStoreTool",
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
# Legacy BaseMemory backend — only present on langchain-core < 1.0.
|
|
24
|
-
try:
|
|
25
|
-
from .memory import CortexDBMemory # noqa: F401
|
|
26
|
-
|
|
27
|
-
__all__.append("CortexDBMemory")
|
|
28
|
-
except ImportError:
|
|
29
|
-
pass
|
|
1
|
+
"""CortexDB integration for LangChain.
|
|
2
|
+
|
|
3
|
+
Provides chat-message history, retrievers, and tools that connect LangChain
|
|
4
|
+
applications to CortexDB's long-term memory system.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .memory import CortexDBChatMessageHistory
|
|
8
|
+
from .retriever import CortexDBRetriever
|
|
9
|
+
from .tools import (
|
|
10
|
+
CortexDBForgetTool,
|
|
11
|
+
CortexDBSearchTool,
|
|
12
|
+
CortexDBStoreTool,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"CortexDBChatMessageHistory",
|
|
17
|
+
"CortexDBRetriever",
|
|
18
|
+
"CortexDBForgetTool",
|
|
19
|
+
"CortexDBSearchTool",
|
|
20
|
+
"CortexDBStoreTool",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Legacy BaseMemory backend — only present on langchain-core < 1.0.
|
|
24
|
+
try:
|
|
25
|
+
from .memory import CortexDBMemory # noqa: F401
|
|
26
|
+
|
|
27
|
+
__all__.append("CortexDBMemory")
|
|
28
|
+
except ImportError:
|
|
29
|
+
pass
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
"""LangChain tools for interacting with CortexDB.
|
|
2
|
-
|
|
3
|
-
Provides search, store, and forget tools that allow LangChain agents
|
|
4
|
-
to interact with CortexDB's memory system as part of their tool-use
|
|
5
|
-
capabilities.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
from typing import Any, Optional, Type
|
|
11
|
-
|
|
12
|
-
from langchain_core.callbacks import CallbackManagerForToolRun
|
|
13
|
-
from langchain_core.tools import BaseTool
|
|
14
|
-
from pydantic import BaseModel, Field
|
|
15
|
-
|
|
16
|
-
from cortexdb import Cortex
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class _SearchInput(BaseModel):
|
|
20
|
-
query: str = Field(description="The search query to find relevant memories.")
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class CortexDBSearchTool(BaseTool):
|
|
24
|
-
"""LangChain tool for searching memories in CortexDB."""
|
|
25
|
-
|
|
26
|
-
name: str = "cortexdb_search"
|
|
27
|
-
description: str = (
|
|
28
|
-
"Search CortexDB for relevant memories and past context. "
|
|
29
|
-
"Use this when you need to recall information from previous "
|
|
30
|
-
"conversations or stored knowledge."
|
|
31
|
-
)
|
|
32
|
-
args_schema: Type[BaseModel] = _SearchInput
|
|
33
|
-
scope: str = "user:default"
|
|
34
|
-
|
|
35
|
-
_client: Cortex
|
|
36
|
-
|
|
37
|
-
def __init__(self, client: Cortex, **kwargs: Any) -> None:
|
|
38
|
-
super().__init__(**kwargs)
|
|
39
|
-
self._client = client
|
|
40
|
-
|
|
41
|
-
def _run(
|
|
42
|
-
self,
|
|
43
|
-
query: str,
|
|
44
|
-
run_manager: Optional[CallbackManagerForToolRun] = None,
|
|
45
|
-
) -> str:
|
|
46
|
-
result = self._client.recall(self.scope, query=query)
|
|
47
|
-
|
|
48
|
-
context = result.get("context_block", "")
|
|
49
|
-
if not context:
|
|
50
|
-
return "No relevant memories found."
|
|
51
|
-
|
|
52
|
-
return context
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class _StoreInput(BaseModel):
|
|
56
|
-
content: str = Field(description="The content to store as a memory.")
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class CortexDBStoreTool(BaseTool):
|
|
60
|
-
"""LangChain tool for storing memories in CortexDB."""
|
|
61
|
-
|
|
62
|
-
name: str = "cortexdb_store"
|
|
63
|
-
description: str = (
|
|
64
|
-
"Store information in CortexDB's long-term memory. "
|
|
65
|
-
"Use this to save important facts, decisions, or context "
|
|
66
|
-
"that should be remembered for future interactions."
|
|
67
|
-
)
|
|
68
|
-
args_schema: Type[BaseModel] = _StoreInput
|
|
69
|
-
scope: str = "user:default"
|
|
70
|
-
|
|
71
|
-
_client: Cortex
|
|
72
|
-
|
|
73
|
-
def __init__(self, client: Cortex, **kwargs: Any) -> None:
|
|
74
|
-
super().__init__(**kwargs)
|
|
75
|
-
self._client = client
|
|
76
|
-
|
|
77
|
-
def _run(
|
|
78
|
-
self,
|
|
79
|
-
content: str,
|
|
80
|
-
run_manager: Optional[CallbackManagerForToolRun] = None,
|
|
81
|
-
) -> str:
|
|
82
|
-
resp = self._client.experience(self.scope, text=content)
|
|
83
|
-
return f"Memory stored successfully (event_id: {resp.get('event_id')})."
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class _ForgetInput(BaseModel):
|
|
87
|
-
query: str = Field(description="Query identifying the memories to forget.")
|
|
88
|
-
reason: str = Field(description="The reason for forgetting these memories.")
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
class CortexDBForgetTool(BaseTool):
|
|
92
|
-
"""LangChain tool for forgetting memories in CortexDB."""
|
|
93
|
-
|
|
94
|
-
name: str = "cortexdb_forget"
|
|
95
|
-
description: str = (
|
|
96
|
-
"Forget or remove memories from CortexDB. "
|
|
97
|
-
"Use this when information should no longer be retained, "
|
|
98
|
-
"such as for privacy compliance or data correction."
|
|
99
|
-
)
|
|
100
|
-
args_schema: Type[BaseModel] = _ForgetInput
|
|
101
|
-
scope: str = "user:default"
|
|
102
|
-
|
|
103
|
-
_client: Cortex
|
|
104
|
-
|
|
105
|
-
def __init__(self, client: Cortex, **kwargs: Any) -> None:
|
|
106
|
-
super().__init__(**kwargs)
|
|
107
|
-
self._client = client
|
|
108
|
-
|
|
109
|
-
def _run(
|
|
110
|
-
self,
|
|
111
|
-
query: str,
|
|
112
|
-
reason: str,
|
|
113
|
-
run_manager: Optional[CallbackManagerForToolRun] = None,
|
|
114
|
-
) -> str:
|
|
115
|
-
resp = self._client.forget(
|
|
116
|
-
self.scope,
|
|
117
|
-
confirm_all=True,
|
|
118
|
-
cascade="redact_events",
|
|
119
|
-
reason=reason,
|
|
120
|
-
)
|
|
121
|
-
return f"Forget request accepted (audit_id: {resp.get('audit_id')})."
|
|
1
|
+
"""LangChain tools for interacting with CortexDB.
|
|
2
|
+
|
|
3
|
+
Provides search, store, and forget tools that allow LangChain agents
|
|
4
|
+
to interact with CortexDB's memory system as part of their tool-use
|
|
5
|
+
capabilities.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any, Optional, Type
|
|
11
|
+
|
|
12
|
+
from langchain_core.callbacks import CallbackManagerForToolRun
|
|
13
|
+
from langchain_core.tools import BaseTool
|
|
14
|
+
from pydantic import BaseModel, Field
|
|
15
|
+
|
|
16
|
+
from cortexdb import Cortex
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _SearchInput(BaseModel):
|
|
20
|
+
query: str = Field(description="The search query to find relevant memories.")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CortexDBSearchTool(BaseTool):
|
|
24
|
+
"""LangChain tool for searching memories in CortexDB."""
|
|
25
|
+
|
|
26
|
+
name: str = "cortexdb_search"
|
|
27
|
+
description: str = (
|
|
28
|
+
"Search CortexDB for relevant memories and past context. "
|
|
29
|
+
"Use this when you need to recall information from previous "
|
|
30
|
+
"conversations or stored knowledge."
|
|
31
|
+
)
|
|
32
|
+
args_schema: Type[BaseModel] = _SearchInput
|
|
33
|
+
scope: str = "user:default"
|
|
34
|
+
|
|
35
|
+
_client: Cortex
|
|
36
|
+
|
|
37
|
+
def __init__(self, client: Cortex, **kwargs: Any) -> None:
|
|
38
|
+
super().__init__(**kwargs)
|
|
39
|
+
self._client = client
|
|
40
|
+
|
|
41
|
+
def _run(
|
|
42
|
+
self,
|
|
43
|
+
query: str,
|
|
44
|
+
run_manager: Optional[CallbackManagerForToolRun] = None,
|
|
45
|
+
) -> str:
|
|
46
|
+
result = self._client.recall(self.scope, query=query)
|
|
47
|
+
|
|
48
|
+
context = result.get("context_block", "")
|
|
49
|
+
if not context:
|
|
50
|
+
return "No relevant memories found."
|
|
51
|
+
|
|
52
|
+
return context
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class _StoreInput(BaseModel):
|
|
56
|
+
content: str = Field(description="The content to store as a memory.")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class CortexDBStoreTool(BaseTool):
|
|
60
|
+
"""LangChain tool for storing memories in CortexDB."""
|
|
61
|
+
|
|
62
|
+
name: str = "cortexdb_store"
|
|
63
|
+
description: str = (
|
|
64
|
+
"Store information in CortexDB's long-term memory. "
|
|
65
|
+
"Use this to save important facts, decisions, or context "
|
|
66
|
+
"that should be remembered for future interactions."
|
|
67
|
+
)
|
|
68
|
+
args_schema: Type[BaseModel] = _StoreInput
|
|
69
|
+
scope: str = "user:default"
|
|
70
|
+
|
|
71
|
+
_client: Cortex
|
|
72
|
+
|
|
73
|
+
def __init__(self, client: Cortex, **kwargs: Any) -> None:
|
|
74
|
+
super().__init__(**kwargs)
|
|
75
|
+
self._client = client
|
|
76
|
+
|
|
77
|
+
def _run(
|
|
78
|
+
self,
|
|
79
|
+
content: str,
|
|
80
|
+
run_manager: Optional[CallbackManagerForToolRun] = None,
|
|
81
|
+
) -> str:
|
|
82
|
+
resp = self._client.experience(self.scope, text=content)
|
|
83
|
+
return f"Memory stored successfully (event_id: {resp.get('event_id')})."
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class _ForgetInput(BaseModel):
|
|
87
|
+
query: str = Field(description="Query identifying the memories to forget.")
|
|
88
|
+
reason: str = Field(description="The reason for forgetting these memories.")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class CortexDBForgetTool(BaseTool):
|
|
92
|
+
"""LangChain tool for forgetting memories in CortexDB."""
|
|
93
|
+
|
|
94
|
+
name: str = "cortexdb_forget"
|
|
95
|
+
description: str = (
|
|
96
|
+
"Forget or remove memories from CortexDB. "
|
|
97
|
+
"Use this when information should no longer be retained, "
|
|
98
|
+
"such as for privacy compliance or data correction."
|
|
99
|
+
)
|
|
100
|
+
args_schema: Type[BaseModel] = _ForgetInput
|
|
101
|
+
scope: str = "user:default"
|
|
102
|
+
|
|
103
|
+
_client: Cortex
|
|
104
|
+
|
|
105
|
+
def __init__(self, client: Cortex, **kwargs: Any) -> None:
|
|
106
|
+
super().__init__(**kwargs)
|
|
107
|
+
self._client = client
|
|
108
|
+
|
|
109
|
+
def _run(
|
|
110
|
+
self,
|
|
111
|
+
query: str,
|
|
112
|
+
reason: str,
|
|
113
|
+
run_manager: Optional[CallbackManagerForToolRun] = None,
|
|
114
|
+
) -> str:
|
|
115
|
+
resp = self._client.forget(
|
|
116
|
+
self.scope,
|
|
117
|
+
confirm_all=True,
|
|
118
|
+
cascade="redact_events",
|
|
119
|
+
reason=reason,
|
|
120
|
+
)
|
|
121
|
+
return f"Forget request accepted (audit_id: {resp.get('audit_id')})."
|