hebbrix 2.0.1__tar.gz → 2.0.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.
- {hebbrix-2.0.1 → hebbrix-2.0.2}/PKG-INFO +1 -1
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix/__init__.py +1 -1
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix/chat.py +31 -10
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix.egg-info/PKG-INFO +1 -1
- {hebbrix-2.0.1 → hebbrix-2.0.2}/pyproject.toml +1 -1
- {hebbrix-2.0.1 → hebbrix-2.0.2}/MANIFEST.in +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/README.md +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix/client.py +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix/exceptions.py +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix/resources.py +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix.egg-info/SOURCES.txt +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix.egg-info/dependency_links.txt +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix.egg-info/requires.txt +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/hebbrix.egg-info/top_level.txt +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/setup.cfg +0 -0
- {hebbrix-2.0.1 → hebbrix-2.0.2}/setup.py +0 -0
|
@@ -286,6 +286,8 @@ class MemoryChat:
|
|
|
286
286
|
response.raise_for_status()
|
|
287
287
|
|
|
288
288
|
# Convenience methods for memory operations
|
|
289
|
+
# These use synchronous requests.post() (same as send/send_with_context)
|
|
290
|
+
# instead of the async MemoryClient to avoid coroutine issues.
|
|
289
291
|
def add_memory(self, content: str, collection_id: str, importance: float = 0.5) -> Dict[str, Any]:
|
|
290
292
|
"""
|
|
291
293
|
Add a memory manually.
|
|
@@ -298,11 +300,20 @@ class MemoryChat:
|
|
|
298
300
|
Returns:
|
|
299
301
|
Created memory dict
|
|
300
302
|
"""
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
url = f"{self.base_url}/v1/memories"
|
|
304
|
+
headers = {
|
|
305
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
306
|
+
"Content-Type": "application/json",
|
|
307
|
+
}
|
|
308
|
+
payload = {
|
|
309
|
+
"content": content,
|
|
310
|
+
"collection_id": collection_id,
|
|
311
|
+
"importance": importance,
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
response = requests.post(url, json=payload, headers=headers)
|
|
315
|
+
response.raise_for_status()
|
|
316
|
+
return response.json()
|
|
306
317
|
|
|
307
318
|
def search_memories(self, query: str, collection_id: Optional[str] = None, limit: int = 10) -> List[Dict[str, Any]]:
|
|
308
319
|
"""
|
|
@@ -316,11 +327,21 @@ class MemoryChat:
|
|
|
316
327
|
Returns:
|
|
317
328
|
List of memory dicts
|
|
318
329
|
"""
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
330
|
+
url = f"{self.base_url}/v1/search"
|
|
331
|
+
headers = {
|
|
332
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
333
|
+
"Content-Type": "application/json",
|
|
334
|
+
}
|
|
335
|
+
payload: Dict[str, Any] = {
|
|
336
|
+
"query": query,
|
|
337
|
+
"limit": limit,
|
|
338
|
+
}
|
|
339
|
+
if collection_id:
|
|
340
|
+
payload["collection_id"] = collection_id
|
|
341
|
+
|
|
342
|
+
response = requests.post(url, json=payload, headers=headers)
|
|
343
|
+
response.raise_for_status()
|
|
344
|
+
return response.json().get("results", [])
|
|
324
345
|
|
|
325
346
|
|
|
326
347
|
# Convenience function for even simpler usage
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|