Spaces:
Paused
Paused
ehl0wr0ld
Rafael Uzarowski
feat: Deduplicate and optimize memory similarity threshold (#389)
2bb217a unverified Download python/tools/memory_save.py from OnyxMunk/GravityFalls: direct link, hf CLI and curl.
- Browser
- Download file 509 Bytes
-
https://huggingface.co/spaces/OnyxMunk/GravityFalls/resolve/main/python/tools/memory_save.py
- Command line
-
hf download hf://spaces/OnyxMunk/GravityFalls/python/tools/memory_save.py
-
curl -L -o memory_save.py https://huggingface.co/spaces/OnyxMunk/GravityFalls/resolve/main/python/tools/memory_save.py
509 Bytes
| from python.helpers.memory import Memory | |
| from python.helpers.tool import Tool, Response | |
| class MemorySave(Tool): | |
| async def execute(self, text="", area="", **kwargs): | |
| if not area: | |
| area = Memory.Area.MAIN.value | |
| metadata = {"area": area, **kwargs} | |
| db = await Memory.get(self.agent) | |
| id = await db.insert_text(text, metadata) | |
| result = self.agent.read_prompt("fw.memory_saved.md", memory_id=id) | |
| return Response(message=result, break_loop=False) | |