diff options
| author | batsumaru <> | 2026-09-17 11:07:06 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-09-17 11:07:06 +0900 |
| commit | c22cdbffa50ac634f7fecf080f3c3b5662e67131 (patch) | |
| tree | 9d3aba8d47c5dfc5bd4c5972edc7a3a579afbe18 /personal_agent/tools/memory.py | |
| parent | 71879695b951dd30bbd6cbd25261e22ac7f8e5d1 (diff) | |
Added importance
Diffstat (limited to 'personal_agent/tools/memory.py')
| -rw-r--r-- | personal_agent/tools/memory.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/personal_agent/tools/memory.py b/personal_agent/tools/memory.py index c84202f..ff91234 100644 --- a/personal_agent/tools/memory.py +++ b/personal_agent/tools/memory.py @@ -252,13 +252,25 @@ class LongTermMemorySaveTool(Tool): "episodic for meaningful past events." ), }, + "importance": { + "type": "integer", + "enum": [1, 2, 3], + "description": ( + "How useful this memory is likely to be in future " + "conversations: 1 = useful but minor, " + "2 = normally useful, " + "3 = especially important for future behavior. " + "Importance measure future usefullness, not emotional intensity." + ), + }, }, - "required": ["content", "category"], + "required": ["content", "category", "importance"], } def execute(self, arguments: dict[str, object]) -> ToolResult: content = arguments.get("content") category = arguments.get("category") + importance = arguments.get("importance") if not isinstance(content, str): raise ToolError("content must be a string") @@ -269,12 +281,18 @@ class LongTermMemorySaveTool(Tool): if not isinstance(category, str): raise ToolError("category must be a string") + if not isinstance(importance, int) or isinstance(importance, bool): + raise ToolError("importance must be an integer") + + if importance not in (1, 2, 3): + raise ToolError("importance must be between 1 and 3") + try: memory_category = MemoryCategory(category) except ValueError: raise ToolError("category must be 'semantic' or 'episodic'") - memory = LongTermMemory.create(content, memory_category) + memory = LongTermMemory.create(content, memory_category, importance) self.store.add(memory) return ToolResult(content=f"Saved memory: {memory.id}") |
