-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_redis_memory.py
More file actions
32 lines (23 loc) · 992 Bytes
/
Copy pathtest_redis_memory.py
File metadata and controls
32 lines (23 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
"""Quick verification that Redis-backed memory works (JSON fallback OK)."""
from memory.jarvis_memory import get_recent_conversations_text
from memory.redis_store import JsonMemoryBackend, get_memory_backend
def main() -> None:
backend = get_memory_backend()
backend_name = type(backend).__name__
print(f"Backend: {backend_name}")
owner = backend.read_owner()
print(f"Owner fields: {len(owner)}")
if owner:
print(f" name: {owner.get('name', '(missing)')}")
facts = backend.get_facts()
print(f"Facts: {len(facts)}")
if facts:
print(f" latest: {facts[-1].get('fact', '')}")
text = get_recent_conversations_text(5)
print(f"Recent conversations:\n{text or '(none)'}")
if isinstance(backend, JsonMemoryBackend):
backend.append_conversation("Redis plugin demo entry", speaker="AGENT")
print("\nAppended demo conversation to JSON fallback store.")
if __name__ == "__main__":
main()