cortexdbai 0.2.1__tar.gz → 0.2.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.
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/PKG-INFO +1 -1
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/__init__.py +1 -1
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/v1/__init__.py +60 -60
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/v1/client.py +691 -608
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/v1/exceptions.py +92 -92
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/pyproject.toml +1 -1
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/.gitignore +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/README.md +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/client.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/exceptions.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/models.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/cortexdb/py.typed +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/tests/__init__.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/tests/conftest.py +0 -0
- {cortexdbai-0.2.1 → cortexdbai-0.2.2}/tests/test_client.py +0 -0
|
@@ -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
|
+
]
|