Spaces:
Runtime error
Runtime error
| # app/api/memory.py | |
| from fastapi import APIRouter | |
| from app.memory.memory_client import MemoryClient | |
| router = APIRouter(prefix="/memory", tags=["memory"]) | |
| def add_memory(user_id: str, content: str): | |
| """ | |
| Store long-term memory in Qdrant cloud. | |
| """ | |
| MemoryClient.add_memory( | |
| user_id=user_id, | |
| content=content, | |
| ) | |
| return { | |
| "status": "stored", | |
| "user_id": user_id, | |
| } | |
| def search_memory(user_id: str, query: str): | |
| """ | |
| Search memory in Qdrant. | |
| """ | |
| results = MemoryClient.search_memory( | |
| user_id=user_id, | |
| query=query, | |
| ) | |
| return { | |
| "results": results, | |
| } |