hebbrix 2.2.0__tar.gz → 2.3.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.
- {hebbrix-2.2.0/hebbrix.egg-info → hebbrix-2.3.0}/PKG-INFO +30 -5
- {hebbrix-2.2.0 → hebbrix-2.3.0}/README.md +26 -3
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix/__init__.py +10 -5
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix/client.py +47 -1
- hebbrix-2.3.0/hebbrix/models.py +40 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix/resources.py +482 -48
- hebbrix-2.3.0/hebbrix/sync_client.py +537 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0/hebbrix.egg-info}/PKG-INFO +30 -5
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix.egg-info/SOURCES.txt +6 -1
- hebbrix-2.3.0/hebbrix.egg-info/requires.txt +15 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/pyproject.toml +4 -2
- hebbrix-2.3.0/tests/test_memories_resource.py +292 -0
- hebbrix-2.3.0/tests/test_openapi_parity.py +111 -0
- hebbrix-2.3.0/tests/test_sync_client.py +126 -0
- hebbrix-2.2.0/hebbrix.egg-info/requires.txt +0 -9
- {hebbrix-2.2.0 → hebbrix-2.3.0}/LICENSE +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/MANIFEST.in +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix/chat.py +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix/exceptions.py +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix.egg-info/dependency_links.txt +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/hebbrix.egg-info/top_level.txt +0 -0
- {hebbrix-2.2.0 → hebbrix-2.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hebbrix
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
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,8 +85,11 @@ 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
|
|
|
90
95
|
# Search memories
|
|
@@ -102,6 +107,26 @@ async def main():
|
|
|
102
107
|
asyncio.run(main())
|
|
103
108
|
```
|
|
104
109
|
|
|
110
|
+
Blocking applications can use the same create/search/ProofLoop fields:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from hebbrix import SyncMemoryClient
|
|
114
|
+
|
|
115
|
+
with SyncMemoryClient(api_key="mem_sk_your_api_key") as client:
|
|
116
|
+
collection = client.collections.create(name="My Agent")
|
|
117
|
+
client.memories.create(
|
|
118
|
+
collection_id=collection["id"],
|
|
119
|
+
user_id="customer-7",
|
|
120
|
+
content="User prefers concise answers",
|
|
121
|
+
wait_for_index=True,
|
|
122
|
+
)
|
|
123
|
+
results = client.search(
|
|
124
|
+
"How should answers be formatted?",
|
|
125
|
+
collection_id=collection["id"],
|
|
126
|
+
user_id="customer-7",
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
105
130
|
## ProofLoop: search → decision → outcome → proof
|
|
106
131
|
|
|
107
132
|
```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,8 +44,11 @@ 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
|
|
|
51
54
|
# Search memories
|
|
@@ -63,6 +66,26 @@ async def main():
|
|
|
63
66
|
asyncio.run(main())
|
|
64
67
|
```
|
|
65
68
|
|
|
69
|
+
Blocking applications can use the same create/search/ProofLoop fields:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from hebbrix import SyncMemoryClient
|
|
73
|
+
|
|
74
|
+
with SyncMemoryClient(api_key="mem_sk_your_api_key") as client:
|
|
75
|
+
collection = client.collections.create(name="My Agent")
|
|
76
|
+
client.memories.create(
|
|
77
|
+
collection_id=collection["id"],
|
|
78
|
+
user_id="customer-7",
|
|
79
|
+
content="User prefers concise answers",
|
|
80
|
+
wait_for_index=True,
|
|
81
|
+
)
|
|
82
|
+
results = client.search(
|
|
83
|
+
"How should answers be formatted?",
|
|
84
|
+
collection_id=collection["id"],
|
|
85
|
+
user_id="customer-7",
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
66
89
|
## ProofLoop: search → decision → outcome → proof
|
|
67
90
|
|
|
68
91
|
```python
|
|
@@ -41,24 +41,26 @@ Features:
|
|
|
41
41
|
- ✅ Type hints throughout
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
|
-
__version__ = "2.
|
|
44
|
+
__version__ = "2.3.0"
|
|
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.0",
|
|
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]
|