hebbrix 2.2.0__tar.gz → 2.3.1__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.
- hebbrix-2.3.1/CHANGELOG.md +23 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/MANIFEST.in +1 -0
- {hebbrix-2.2.0/hebbrix.egg-info → hebbrix-2.3.1}/PKG-INFO +34 -5
- {hebbrix-2.2.0 → hebbrix-2.3.1}/README.md +30 -3
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix/__init__.py +10 -5
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix/client.py +47 -1
- hebbrix-2.3.1/hebbrix/models.py +40 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix/resources.py +583 -48
- hebbrix-2.3.1/hebbrix/sync_client.py +621 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1/hebbrix.egg-info}/PKG-INFO +34 -5
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix.egg-info/SOURCES.txt +7 -1
- hebbrix-2.3.1/hebbrix.egg-info/requires.txt +15 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/pyproject.toml +4 -2
- hebbrix-2.3.1/tests/test_memories_resource.py +392 -0
- hebbrix-2.3.1/tests/test_openapi_parity.py +111 -0
- hebbrix-2.3.1/tests/test_sync_client.py +130 -0
- hebbrix-2.2.0/hebbrix.egg-info/requires.txt +0 -9
- {hebbrix-2.2.0 → hebbrix-2.3.1}/LICENSE +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix/chat.py +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix/exceptions.py +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix.egg-info/dependency_links.txt +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/hebbrix.egg-info/top_level.txt +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.1}/setup.cfg +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.3.1 — 2026-08-26
|
|
4
|
+
|
|
5
|
+
- Make `wait_for_index=True` poll the authoritative memory or job readiness
|
|
6
|
+
endpoint instead of returning a non-searchable receipt.
|
|
7
|
+
- Add `memories.wait_until_searchable(...)` to the async and synchronous
|
|
8
|
+
clients, with explicit timeout and terminal-failure handling.
|
|
9
|
+
- Preserve valid evidence-bound search rows during a degraded or abstaining
|
|
10
|
+
server response while retaining the safety metadata; malformed and explicit
|
|
11
|
+
no-match envelopes still fail closed.
|
|
12
|
+
- Keep the synchronous and asynchronous memory create, scope, idempotency, and
|
|
13
|
+
search-safety behavior aligned.
|
|
14
|
+
- Add `temporal.delete_fact(fact_id)` for tenant-scoped, idempotent cleanup of
|
|
15
|
+
facts created through the temporal API.
|
|
16
|
+
|
|
17
|
+
The supported server/SDK release pair is published by the server OpenAPI
|
|
18
|
+
document in `info.x-hebbrix-sdk-compatibility`. Patch releases preserve the
|
|
19
|
+
public API within the same major version.
|
|
20
|
+
|
|
21
|
+
## 2.3.0
|
|
22
|
+
|
|
23
|
+
- Added the GA scoped memory, corrections, search proof, and ProofLoop surface.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hebbrix
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration
|
|
5
5
|
Author-email: Hebbrix Team <support@hebbrix.com>
|
|
6
6
|
Maintainer-email: Hebbrix Team <support@hebbrix.com>
|
|
@@ -33,8 +33,10 @@ Provides-Extra: dev
|
|
|
33
33
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
34
34
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
35
35
|
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
36
|
-
Requires-Dist: flake8
|
|
36
|
+
Requires-Dist: flake8<6.0.0,>=5.0.4; python_full_version < "3.8.1" and extra == "dev"
|
|
37
|
+
Requires-Dist: flake8>=6.0.0; python_full_version >= "3.8.1" and extra == "dev"
|
|
37
38
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: cryptography>=42.0.0; extra == "dev"
|
|
38
40
|
Dynamic: license-file
|
|
39
41
|
|
|
40
42
|
# Hebbrix Python SDK
|
|
@@ -47,14 +49,14 @@ Official Python SDK for the Hebbrix api - **the only memory API with Reinforceme
|
|
|
47
49
|
|
|
48
50
|
## 🚀 Features
|
|
49
51
|
|
|
50
|
-
- ✅ **
|
|
52
|
+
- ✅ **Core API Coverage** - Typed resources for memories, search, and ProofLoop
|
|
51
53
|
- ✅ **Reinforcement Learning** - Train AI agents to optimize memory operations
|
|
52
54
|
- ✅ **Temporal Knowledge Graphs** - Track facts over time with bi-temporal model
|
|
53
55
|
- ✅ **Procedural Memory** - Store and execute learned skills
|
|
54
56
|
- ✅ **Working Memory** - Short-term context buffer for conversations
|
|
55
57
|
- ✅ **Memory Consolidation** - Automatic compression of episodic memories
|
|
56
58
|
- ✅ **ProofLoop** - Learn from outcomes with automatic, verifiable evidence receipts
|
|
57
|
-
- ✅ **Async
|
|
59
|
+
- ✅ **Sync + Async** - Equivalent core memory and ProofLoop workflows
|
|
58
60
|
- ✅ **Type Hints** - Complete type annotations
|
|
59
61
|
- ✅ **Clean API** - Pythonic, intuitive interface
|
|
60
62
|
|
|
@@ -83,10 +85,17 @@ async def main():
|
|
|
83
85
|
# Store a memory
|
|
84
86
|
memory = await client.memories.create(
|
|
85
87
|
collection_id=collection["id"],
|
|
88
|
+
user_id="customer-7",
|
|
89
|
+
agent_id="support-agent",
|
|
86
90
|
content="User prefers dark mode and loves Python",
|
|
87
|
-
importance=0.9
|
|
91
|
+
importance=0.9,
|
|
92
|
+
wait_for_index=True,
|
|
88
93
|
)
|
|
89
94
|
|
|
95
|
+
# wait_for_index=True polls the returned memory status through the SDK.
|
|
96
|
+
# It returns only when searchable=true, raises on terminal failure, and
|
|
97
|
+
# raises TimeoutError if the caller's readiness deadline expires.
|
|
98
|
+
|
|
90
99
|
# Search memories
|
|
91
100
|
results = await client.search(
|
|
92
101
|
query="What programming language does user like?",
|
|
@@ -102,6 +111,26 @@ async def main():
|
|
|
102
111
|
asyncio.run(main())
|
|
103
112
|
```
|
|
104
113
|
|
|
114
|
+
Blocking applications can use the same create/search/ProofLoop fields:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from hebbrix import SyncMemoryClient
|
|
118
|
+
|
|
119
|
+
with SyncMemoryClient(api_key="mem_sk_your_api_key") as client:
|
|
120
|
+
collection = client.collections.create(name="My Agent")
|
|
121
|
+
client.memories.create(
|
|
122
|
+
collection_id=collection["id"],
|
|
123
|
+
user_id="customer-7",
|
|
124
|
+
content="User prefers concise answers",
|
|
125
|
+
wait_for_index=True,
|
|
126
|
+
)
|
|
127
|
+
results = client.search(
|
|
128
|
+
"How should answers be formatted?",
|
|
129
|
+
collection_id=collection["id"],
|
|
130
|
+
user_id="customer-7",
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
105
134
|
## ProofLoop: search → decision → outcome → proof
|
|
106
135
|
|
|
107
136
|
```python
|
|
@@ -8,14 +8,14 @@ Official Python SDK for the Hebbrix api - **the only memory API with Reinforceme
|
|
|
8
8
|
|
|
9
9
|
## 🚀 Features
|
|
10
10
|
|
|
11
|
-
- ✅ **
|
|
11
|
+
- ✅ **Core API Coverage** - Typed resources for memories, search, and ProofLoop
|
|
12
12
|
- ✅ **Reinforcement Learning** - Train AI agents to optimize memory operations
|
|
13
13
|
- ✅ **Temporal Knowledge Graphs** - Track facts over time with bi-temporal model
|
|
14
14
|
- ✅ **Procedural Memory** - Store and execute learned skills
|
|
15
15
|
- ✅ **Working Memory** - Short-term context buffer for conversations
|
|
16
16
|
- ✅ **Memory Consolidation** - Automatic compression of episodic memories
|
|
17
17
|
- ✅ **ProofLoop** - Learn from outcomes with automatic, verifiable evidence receipts
|
|
18
|
-
- ✅ **Async
|
|
18
|
+
- ✅ **Sync + Async** - Equivalent core memory and ProofLoop workflows
|
|
19
19
|
- ✅ **Type Hints** - Complete type annotations
|
|
20
20
|
- ✅ **Clean API** - Pythonic, intuitive interface
|
|
21
21
|
|
|
@@ -44,10 +44,17 @@ async def main():
|
|
|
44
44
|
# Store a memory
|
|
45
45
|
memory = await client.memories.create(
|
|
46
46
|
collection_id=collection["id"],
|
|
47
|
+
user_id="customer-7",
|
|
48
|
+
agent_id="support-agent",
|
|
47
49
|
content="User prefers dark mode and loves Python",
|
|
48
|
-
importance=0.9
|
|
50
|
+
importance=0.9,
|
|
51
|
+
wait_for_index=True,
|
|
49
52
|
)
|
|
50
53
|
|
|
54
|
+
# wait_for_index=True polls the returned memory status through the SDK.
|
|
55
|
+
# It returns only when searchable=true, raises on terminal failure, and
|
|
56
|
+
# raises TimeoutError if the caller's readiness deadline expires.
|
|
57
|
+
|
|
51
58
|
# Search memories
|
|
52
59
|
results = await client.search(
|
|
53
60
|
query="What programming language does user like?",
|
|
@@ -63,6 +70,26 @@ async def main():
|
|
|
63
70
|
asyncio.run(main())
|
|
64
71
|
```
|
|
65
72
|
|
|
73
|
+
Blocking applications can use the same create/search/ProofLoop fields:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from hebbrix import SyncMemoryClient
|
|
77
|
+
|
|
78
|
+
with SyncMemoryClient(api_key="mem_sk_your_api_key") as client:
|
|
79
|
+
collection = client.collections.create(name="My Agent")
|
|
80
|
+
client.memories.create(
|
|
81
|
+
collection_id=collection["id"],
|
|
82
|
+
user_id="customer-7",
|
|
83
|
+
content="User prefers concise answers",
|
|
84
|
+
wait_for_index=True,
|
|
85
|
+
)
|
|
86
|
+
results = client.search(
|
|
87
|
+
"How should answers be formatted?",
|
|
88
|
+
collection_id=collection["id"],
|
|
89
|
+
user_id="customer-7",
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
66
93
|
## ProofLoop: search → decision → outcome → proof
|
|
67
94
|
|
|
68
95
|
```python
|
|
@@ -41,24 +41,26 @@ Features:
|
|
|
41
41
|
- ✅ Type hints throughout
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
|
-
__version__ = "2.
|
|
44
|
+
__version__ = "2.3.1"
|
|
45
45
|
__author__ = "Hebbrix Team"
|
|
46
46
|
__license__ = "MIT"
|
|
47
47
|
|
|
48
|
-
from hebbrix.client import MemoryClient
|
|
49
48
|
from hebbrix.chat import MemoryChat
|
|
49
|
+
from hebbrix.client import MemoryClient
|
|
50
50
|
from hebbrix.exceptions import (
|
|
51
|
-
HebbrixError,
|
|
52
51
|
AuthenticationError,
|
|
53
|
-
|
|
52
|
+
HebbrixError,
|
|
54
53
|
NotFoundError,
|
|
55
54
|
RateLimitError,
|
|
56
55
|
ServerError,
|
|
56
|
+
ValidationError,
|
|
57
57
|
)
|
|
58
|
-
|
|
58
|
+
from hebbrix.models import EvidenceClaim, GroundingReceipt, SearchSafetyEnvelope
|
|
59
|
+
from hebbrix.sync_client import SyncMemoryClient
|
|
59
60
|
|
|
60
61
|
__all__ = [
|
|
61
62
|
"MemoryClient",
|
|
63
|
+
"SyncMemoryClient",
|
|
62
64
|
"MemoryChat",
|
|
63
65
|
"HebbrixError",
|
|
64
66
|
"AuthenticationError",
|
|
@@ -66,4 +68,7 @@ __all__ = [
|
|
|
66
68
|
"NotFoundError",
|
|
67
69
|
"RateLimitError",
|
|
68
70
|
"ServerError",
|
|
71
|
+
"GroundingReceipt",
|
|
72
|
+
"EvidenceClaim",
|
|
73
|
+
"SearchSafetyEnvelope",
|
|
69
74
|
]
|
|
@@ -20,7 +20,9 @@ from hebbrix.resources import (
|
|
|
20
20
|
AuthResource,
|
|
21
21
|
CollectionsResource,
|
|
22
22
|
ConsolidationResource,
|
|
23
|
+
CorrectionsResource,
|
|
23
24
|
MemoriesResource,
|
|
25
|
+
MemoryJobsResource,
|
|
24
26
|
MemoryToolsResource,
|
|
25
27
|
ProceduralResource,
|
|
26
28
|
ProofLoopResource,
|
|
@@ -73,6 +75,8 @@ class MemoryClient:
|
|
|
73
75
|
self.auth = AuthResource(self)
|
|
74
76
|
self.collections = CollectionsResource(self)
|
|
75
77
|
self.memories = MemoriesResource(self)
|
|
78
|
+
self.memory_jobs = MemoryJobsResource(self)
|
|
79
|
+
self.corrections = CorrectionsResource(self)
|
|
76
80
|
self.search_resource = SearchResource(self)
|
|
77
81
|
self.proofloop = ProofLoopResource(self)
|
|
78
82
|
self.rl = RLResource(self)
|
|
@@ -87,7 +91,7 @@ class MemoryClient:
|
|
|
87
91
|
"""Get request headers."""
|
|
88
92
|
headers = {
|
|
89
93
|
"Content-Type": "application/json",
|
|
90
|
-
"User-Agent": "hebbrix-python/2.
|
|
94
|
+
"User-Agent": "hebbrix-python/2.3.1",
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
if self.api_key:
|
|
@@ -175,6 +179,14 @@ class MemoryClient:
|
|
|
175
179
|
limit: int = 10,
|
|
176
180
|
search_type: str = "hybrid",
|
|
177
181
|
filters: Optional[Dict[str, Any]] = None,
|
|
182
|
+
user_id: Optional[str] = None,
|
|
183
|
+
agent_id: Optional[str] = None,
|
|
184
|
+
run_id: Optional[str] = None,
|
|
185
|
+
fast: Optional[bool] = None,
|
|
186
|
+
threshold: Optional[float] = None,
|
|
187
|
+
include_low_confidence: bool = False,
|
|
188
|
+
group_by_source: bool = True,
|
|
189
|
+
debug: bool = False,
|
|
178
190
|
) -> List[Dict[str, Any]]:
|
|
179
191
|
"""
|
|
180
192
|
Search memories.
|
|
@@ -195,6 +207,14 @@ class MemoryClient:
|
|
|
195
207
|
limit=limit,
|
|
196
208
|
search_type=search_type,
|
|
197
209
|
filters=filters or {},
|
|
210
|
+
user_id=user_id,
|
|
211
|
+
agent_id=agent_id,
|
|
212
|
+
run_id=run_id,
|
|
213
|
+
fast=fast,
|
|
214
|
+
threshold=threshold,
|
|
215
|
+
include_low_confidence=include_low_confidence,
|
|
216
|
+
group_by_source=group_by_source,
|
|
217
|
+
debug=debug,
|
|
198
218
|
)
|
|
199
219
|
|
|
200
220
|
async def search_with_proof(
|
|
@@ -205,6 +225,13 @@ class MemoryClient:
|
|
|
205
225
|
search_type: str = "hybrid",
|
|
206
226
|
filters: Optional[Dict[str, Any]] = None,
|
|
207
227
|
user_id: Optional[str] = None,
|
|
228
|
+
agent_id: Optional[str] = None,
|
|
229
|
+
run_id: Optional[str] = None,
|
|
230
|
+
fast: Optional[bool] = None,
|
|
231
|
+
threshold: Optional[float] = None,
|
|
232
|
+
include_low_confidence: bool = False,
|
|
233
|
+
group_by_source: bool = True,
|
|
234
|
+
debug: bool = False,
|
|
208
235
|
) -> Dict[str, Any]:
|
|
209
236
|
"""Search and return both results and the automatic ProofLoop context."""
|
|
210
237
|
|
|
@@ -215,6 +242,13 @@ class MemoryClient:
|
|
|
215
242
|
search_type=search_type,
|
|
216
243
|
filters=filters or {},
|
|
217
244
|
user_id=user_id,
|
|
245
|
+
agent_id=agent_id,
|
|
246
|
+
run_id=run_id,
|
|
247
|
+
fast=fast,
|
|
248
|
+
threshold=threshold,
|
|
249
|
+
include_low_confidence=include_low_confidence,
|
|
250
|
+
group_by_source=group_by_source,
|
|
251
|
+
debug=debug,
|
|
218
252
|
)
|
|
219
253
|
|
|
220
254
|
async def reason(
|
|
@@ -223,6 +257,10 @@ class MemoryClient:
|
|
|
223
257
|
collection_id: Optional[str] = None,
|
|
224
258
|
provider: Optional[str] = None,
|
|
225
259
|
include_steps: bool = False,
|
|
260
|
+
user_id: Optional[str] = None,
|
|
261
|
+
agent_id: Optional[str] = None,
|
|
262
|
+
run_id: Optional[str] = None,
|
|
263
|
+
facets: Optional[List[str]] = None,
|
|
226
264
|
) -> Dict[str, Any]:
|
|
227
265
|
"""
|
|
228
266
|
Perform reasoning over memories.
|
|
@@ -232,6 +270,10 @@ class MemoryClient:
|
|
|
232
270
|
collection_id: Optional collection filter
|
|
233
271
|
provider: LLM provider (gemini, openai, anthropic)
|
|
234
272
|
include_steps: Include reasoning steps
|
|
273
|
+
user_id: End-user isolation scope
|
|
274
|
+
agent_id: Agent isolation scope
|
|
275
|
+
run_id: Run isolation scope
|
|
276
|
+
facets: Optional typed decomposition facets
|
|
235
277
|
|
|
236
278
|
Returns:
|
|
237
279
|
Reasoning result with answer and sources
|
|
@@ -241,6 +283,10 @@ class MemoryClient:
|
|
|
241
283
|
collection_id=collection_id,
|
|
242
284
|
provider=provider,
|
|
243
285
|
include_steps=include_steps,
|
|
286
|
+
user_id=user_id,
|
|
287
|
+
agent_id=agent_id,
|
|
288
|
+
run_id=run_id,
|
|
289
|
+
facets=facets,
|
|
244
290
|
)
|
|
245
291
|
|
|
246
292
|
async def close(self):
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Public response contracts for evidence-bearing Hebbrix operations."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, TypedDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class GroundingReceipt(TypedDict, total=False):
|
|
7
|
+
"""Authoritative claim-grounding decision returned by the API."""
|
|
8
|
+
|
|
9
|
+
status: str
|
|
10
|
+
reason: str
|
|
11
|
+
contract_version: str
|
|
12
|
+
requested_predicate: str
|
|
13
|
+
requested_attribute: str
|
|
14
|
+
subject_anchors: List[str]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class EvidenceClaim(TypedDict, total=False):
|
|
18
|
+
"""Claims attributed to one exact memory evidence identifier."""
|
|
19
|
+
|
|
20
|
+
memory_id: str
|
|
21
|
+
claims: Dict[str, Any]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SearchSafetyEnvelope(TypedDict, total=False):
|
|
25
|
+
"""Fail-closed response shared by search and reasoning helpers."""
|
|
26
|
+
|
|
27
|
+
query: str
|
|
28
|
+
results: List[Dict[str, Any]]
|
|
29
|
+
sources: List[Dict[str, Any]]
|
|
30
|
+
total: int
|
|
31
|
+
no_match: bool
|
|
32
|
+
abstain_recommended: bool
|
|
33
|
+
query_confidence: float
|
|
34
|
+
grounding: GroundingReceipt
|
|
35
|
+
evidence_ids: List[str]
|
|
36
|
+
evidence_claims: List[EvidenceClaim]
|
|
37
|
+
safety_contract_version: str
|
|
38
|
+
degraded: bool
|
|
39
|
+
sdk_safety_reason: str
|
|
40
|
+
proof_context: Dict[str, Any]
|