dnyana 0.1.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.
- dnyana-0.1.0/.gitignore +4 -0
- dnyana-0.1.0/CHANGELOG.md +5 -0
- dnyana-0.1.0/LICENSE +21 -0
- dnyana-0.1.0/PKG-INFO +93 -0
- dnyana-0.1.0/README.md +62 -0
- dnyana-0.1.0/pyproject.toml +50 -0
- dnyana-0.1.0/src/dnyana/__init__.py +67 -0
- dnyana-0.1.0/src/dnyana/_client.py +746 -0
- dnyana-0.1.0/src/dnyana/_errors.py +87 -0
- dnyana-0.1.0/src/dnyana/_models.py +885 -0
- dnyana-0.1.0/src/dnyana/py.typed +0 -0
dnyana-0.1.0/.gitignore
ADDED
dnyana-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dnyana
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dnyana-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dnyana
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Dnyana memory API
|
|
5
|
+
Project-URL: Homepage, https://dnyana.ai
|
|
6
|
+
Project-URL: Documentation, https://dnyana.ai/docs
|
|
7
|
+
Author-email: Dnyana <support@dnyana.ai>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,ai,context,dnyana,llm,memory
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: httpx<1,>=0.27
|
|
25
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
26
|
+
Requires-Dist: typing-extensions>=4.12
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: anyio>=4; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# dnyana (Python)
|
|
33
|
+
|
|
34
|
+
Python client for the Dnyana memory API. Sync (`Dnyana`) and async (`AsyncDnyana`), built on httpx, with pydantic models generated from the API's OpenAPI spec.
|
|
35
|
+
|
|
36
|
+
Requires Python 3.10+.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install dnyana # or: uv add dnyana
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from dnyana import Dnyana
|
|
46
|
+
|
|
47
|
+
client = Dnyana() # reads DNYANA_API_KEY; DNYANA_API_URL overrides the base URL
|
|
48
|
+
|
|
49
|
+
client.memories.add(user_id="user_123", text="Prefers window seats on long flights")
|
|
50
|
+
hits = client.memories.search(user_id="user_123", query="seat preference")
|
|
51
|
+
ctx = client.get_context(user_id="user_123", query="Book me a flight to Oslo", token_budget=2000)
|
|
52
|
+
print(ctx.context) # paste into your LLM prompt
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Async:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from dnyana import AsyncDnyana
|
|
59
|
+
|
|
60
|
+
async with AsyncDnyana() as client:
|
|
61
|
+
ctx = await client.get_context(user_id="user_123", query="...")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Methods: `memories.add / add_batch / search / list / list_all / get / update / delete`, `sessions.add_messages / list / get / finalize / delete`, `users.delete`, `get_context`, `prepare` (call when a session opens), `get_usage`, `whoami`. Responses are pydantic models (`dnyana.types`).
|
|
65
|
+
|
|
66
|
+
Every method also takes `timeout=`, `request_id=`, `max_retries=` and `on_response=`.
|
|
67
|
+
|
|
68
|
+
## Errors
|
|
69
|
+
|
|
70
|
+
API errors raise `dnyana.APIError` subclasses with `status`, `code`, `message` and `request_id`:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import dnyana
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
client.memories.get("mem_missing", user_id="user_123")
|
|
77
|
+
except dnyana.NotFoundError as e:
|
|
78
|
+
print(e.code, e.request_id)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Classes: `BadRequestError` (400/413), `AuthenticationError` (401), `PermissionDeniedError` (403), `NotFoundError` (404), `ConflictError` (409), `RateLimitError` (429), `InternalServerError` (5xx), `ServiceUnavailableError` (503). No response at all raises `APIConnectionError` (or `APITimeoutError`).
|
|
82
|
+
|
|
83
|
+
## Retries, timeouts, rate limits
|
|
84
|
+
|
|
85
|
+
- 429 and 503 are retried (default 2 retries), waiting for `Retry-After`. If the server asks to wait more than 60 s, or the monthly quota is used up, the error is raised at once.
|
|
86
|
+
- Network errors, timeouts, 502 and 504 are retried only for calls that are safe to repeat: reads, deletes, updates, search, context, finalize, and session appends.
|
|
87
|
+
- `sessions.add_messages` sends an `Idempotency-Key` (generated if you pass none) and reuses it on retries, so a message is never appended twice.
|
|
88
|
+
- Timeout: 30 s per attempt (`Dnyana(timeout=...)` or per call).
|
|
89
|
+
- `on_response` receives a `ResponseInfo` with `rate_limit` (from `RateLimit-*`) and `quota_warning` (from `Dnyana-Quota-Warning`, e.g. `{"requests": 80.0}`).
|
|
90
|
+
|
|
91
|
+
Docs: https://dnyana.ai/docs. Support: support@dnyana.ai.
|
|
92
|
+
|
|
93
|
+
MIT License.
|
dnyana-0.1.0/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# dnyana (Python)
|
|
2
|
+
|
|
3
|
+
Python client for the Dnyana memory API. Sync (`Dnyana`) and async (`AsyncDnyana`), built on httpx, with pydantic models generated from the API's OpenAPI spec.
|
|
4
|
+
|
|
5
|
+
Requires Python 3.10+.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install dnyana # or: uv add dnyana
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quickstart
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from dnyana import Dnyana
|
|
15
|
+
|
|
16
|
+
client = Dnyana() # reads DNYANA_API_KEY; DNYANA_API_URL overrides the base URL
|
|
17
|
+
|
|
18
|
+
client.memories.add(user_id="user_123", text="Prefers window seats on long flights")
|
|
19
|
+
hits = client.memories.search(user_id="user_123", query="seat preference")
|
|
20
|
+
ctx = client.get_context(user_id="user_123", query="Book me a flight to Oslo", token_budget=2000)
|
|
21
|
+
print(ctx.context) # paste into your LLM prompt
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Async:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from dnyana import AsyncDnyana
|
|
28
|
+
|
|
29
|
+
async with AsyncDnyana() as client:
|
|
30
|
+
ctx = await client.get_context(user_id="user_123", query="...")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Methods: `memories.add / add_batch / search / list / list_all / get / update / delete`, `sessions.add_messages / list / get / finalize / delete`, `users.delete`, `get_context`, `prepare` (call when a session opens), `get_usage`, `whoami`. Responses are pydantic models (`dnyana.types`).
|
|
34
|
+
|
|
35
|
+
Every method also takes `timeout=`, `request_id=`, `max_retries=` and `on_response=`.
|
|
36
|
+
|
|
37
|
+
## Errors
|
|
38
|
+
|
|
39
|
+
API errors raise `dnyana.APIError` subclasses with `status`, `code`, `message` and `request_id`:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import dnyana
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
client.memories.get("mem_missing", user_id="user_123")
|
|
46
|
+
except dnyana.NotFoundError as e:
|
|
47
|
+
print(e.code, e.request_id)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Classes: `BadRequestError` (400/413), `AuthenticationError` (401), `PermissionDeniedError` (403), `NotFoundError` (404), `ConflictError` (409), `RateLimitError` (429), `InternalServerError` (5xx), `ServiceUnavailableError` (503). No response at all raises `APIConnectionError` (or `APITimeoutError`).
|
|
51
|
+
|
|
52
|
+
## Retries, timeouts, rate limits
|
|
53
|
+
|
|
54
|
+
- 429 and 503 are retried (default 2 retries), waiting for `Retry-After`. If the server asks to wait more than 60 s, or the monthly quota is used up, the error is raised at once.
|
|
55
|
+
- Network errors, timeouts, 502 and 504 are retried only for calls that are safe to repeat: reads, deletes, updates, search, context, finalize, and session appends.
|
|
56
|
+
- `sessions.add_messages` sends an `Idempotency-Key` (generated if you pass none) and reuses it on retries, so a message is never appended twice.
|
|
57
|
+
- Timeout: 30 s per attempt (`Dnyana(timeout=...)` or per call).
|
|
58
|
+
- `on_response` receives a `ResponseInfo` with `rate_limit` (from `RateLimit-*`) and `quota_warning` (from `Dnyana-Quota-Warning`, e.g. `{"requests": 80.0}`).
|
|
59
|
+
|
|
60
|
+
Docs: https://dnyana.ai/docs. Support: support@dnyana.ai.
|
|
61
|
+
|
|
62
|
+
MIT License.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dnyana"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python client for the Dnyana memory API"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Dnyana", email = "support@dnyana.ai" }]
|
|
10
|
+
keywords = ["dnyana", "memory", "llm", "ai", "agents", "context"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"httpx>=0.27,<1",
|
|
27
|
+
"pydantic>=2.7,<3",
|
|
28
|
+
"typing_extensions>=4.12",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://dnyana.ai"
|
|
33
|
+
Documentation = "https://dnyana.ai/docs"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = ["pytest>=8", "anyio>=4"]
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["hatchling>=1.27"]
|
|
40
|
+
build-backend = "hatchling.build"
|
|
41
|
+
|
|
42
|
+
# Published files are whitelisted: no tests, lockfile or dev notes.
|
|
43
|
+
[tool.hatch.build.targets.sdist]
|
|
44
|
+
only-include = ["src/dnyana", "README.md", "LICENSE", "CHANGELOG.md", "pyproject.toml"]
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.wheel]
|
|
47
|
+
packages = ["src/dnyana"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Python client for the Dnyana memory API (https://dnyana.ai/docs)."""
|
|
2
|
+
|
|
3
|
+
from . import _models as types
|
|
4
|
+
from ._client import (
|
|
5
|
+
DEFAULT_BASE_URL,
|
|
6
|
+
AsyncDnyana,
|
|
7
|
+
Dnyana,
|
|
8
|
+
RateLimit,
|
|
9
|
+
RequestOptions,
|
|
10
|
+
ResponseInfo,
|
|
11
|
+
__version__,
|
|
12
|
+
)
|
|
13
|
+
from ._errors import (
|
|
14
|
+
APIConnectionError,
|
|
15
|
+
APIError,
|
|
16
|
+
APITimeoutError,
|
|
17
|
+
AuthenticationError,
|
|
18
|
+
BadRequestError,
|
|
19
|
+
ConflictError,
|
|
20
|
+
DnyanaError,
|
|
21
|
+
InternalServerError,
|
|
22
|
+
NotFoundError,
|
|
23
|
+
PermissionDeniedError,
|
|
24
|
+
RateLimitError,
|
|
25
|
+
ServiceUnavailableError,
|
|
26
|
+
)
|
|
27
|
+
from ._models import (
|
|
28
|
+
ContextItem,
|
|
29
|
+
ContextResponse,
|
|
30
|
+
Memory,
|
|
31
|
+
MemoryInput,
|
|
32
|
+
MessageInput,
|
|
33
|
+
SearchHit,
|
|
34
|
+
SearchMemoriesResponse,
|
|
35
|
+
Session,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"DEFAULT_BASE_URL",
|
|
40
|
+
"APIConnectionError",
|
|
41
|
+
"APIError",
|
|
42
|
+
"APITimeoutError",
|
|
43
|
+
"AsyncDnyana",
|
|
44
|
+
"AuthenticationError",
|
|
45
|
+
"BadRequestError",
|
|
46
|
+
"ConflictError",
|
|
47
|
+
"ContextItem",
|
|
48
|
+
"ContextResponse",
|
|
49
|
+
"Dnyana",
|
|
50
|
+
"DnyanaError",
|
|
51
|
+
"InternalServerError",
|
|
52
|
+
"Memory",
|
|
53
|
+
"MemoryInput",
|
|
54
|
+
"MessageInput",
|
|
55
|
+
"NotFoundError",
|
|
56
|
+
"PermissionDeniedError",
|
|
57
|
+
"RateLimit",
|
|
58
|
+
"RateLimitError",
|
|
59
|
+
"RequestOptions",
|
|
60
|
+
"ResponseInfo",
|
|
61
|
+
"SearchHit",
|
|
62
|
+
"SearchMemoriesResponse",
|
|
63
|
+
"ServiceUnavailableError",
|
|
64
|
+
"Session",
|
|
65
|
+
"__version__",
|
|
66
|
+
"types",
|
|
67
|
+
]
|