Spaces:
Paused
Paused
ehl0wr0ld
Rafael Uzarowski
feat: Deduplicate and optimize memory similarity threshold (#389)
2bb217a unverified Download python/tools/memory_forget.py from OnyxMunk/GravityFalls: direct link, hf CLI and curl.
- Browser
- Download file 551 Bytes
-
https://huggingface.co/spaces/OnyxMunk/GravityFalls/resolve/main/python/tools/memory_forget.py
- Command line
-
hf download hf://spaces/OnyxMunk/GravityFalls/python/tools/memory_forget.py
-
curl -L -o memory_forget.py https://huggingface.co/spaces/OnyxMunk/GravityFalls/resolve/main/python/tools/memory_forget.py
551 Bytes
| from python.helpers.memory import Memory | |
| from python.helpers.tool import Tool, Response | |
| from python.tools.memory_load import DEFAULT_THRESHOLD | |
| class MemoryForget(Tool): | |
| async def execute(self, query="", threshold=DEFAULT_THRESHOLD, filter="", **kwargs): | |
| db = await Memory.get(self.agent) | |
| dels = await db.delete_documents_by_query(query=query, threshold=threshold, filter=filter) | |
| result = self.agent.read_prompt("fw.memories_deleted.md", memory_count=len(dels)) | |
| return Response(message=result, break_loop=False) | |