Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: rename memory tool arguments for consistency with edit tool [LET-6972] (#8631)

Kevin Lin758b74b9c476
diff --git a/letta/functions/function_sets/base.py b/letta/functions/function_sets/base.py
index 004fac5ad..f1318875a 100644
--- a/letta/functions/function_sets/base.py
+++ b/letta/functions/function_sets/base.py
@@ -12,8 +12,8 @@ def memory(
path: Optional[str] = None,
file_text: Optional[str] = None,
description: Optional[str] = None,
- old_str: Optional[str] = None,
- new_str: Optional[str] = None,
+ old_string: Optional[str] = None,
+ new_string: Optional[str] = None,
insert_line: Optional[int] = None,
insert_text: Optional[str] = None,
old_path: Optional[str] = None,
@@ -32,8 +32,8 @@ def memory(
path (Optional[str]): Path to the memory block (for str_replace, insert, delete)
file_text (Optional[str]): The value to set in the memory block (for create)
description (Optional[str]): The description to set in the memory block (for create, rename)
- old_str (Optional[str]): Old text to replace (for str_replace)
- new_str (Optional[str]): New text to replace with (for str_replace)
+ old_string (Optional[str]): Old text to replace (for str_replace)
+ new_string (Optional[str]): New text to replace with (for str_replace)
insert_line (Optional[int]): Line number to insert at (for insert)
insert_text (Optional[str]): Text to insert (for insert)
old_path (Optional[str]): Old path for rename operation
@@ -44,7 +44,7 @@ def memory(
Examples:
# Replace text in a memory block
- memory(agent_state, "str_replace", path="/memories/user_preferences", old_str="theme: dark", new_str="theme: light")
+ memory(agent_state, "str_replace", path="/memories/user_preferences", old_string="theme: dark", new_string="theme: light")
# Insert text at line 5
memory(agent_state, "insert", path="/memories/notes", insert_line=5, insert_text="New note here")
diff --git a/letta/services/tool_executor/core_tool_executor.py b/letta/services/tool_executor/core_tool_executor.py
index f395b4ff0..5688bcad1 100644
--- a/letta/services/tool_executor/core_tool_executor.py
+++ b/letta/services/tool_executor/core_tool_executor.py
@@ -865,8 +865,8 @@ class LettaCoreToolExecutor(ToolExecutor):
file_text: Optional[str] = None,
description: Optional[str] = None,
path: Optional[str] = None,
- old_str: Optional[str] = None,
- new_str: Optional[str] = None,
+ old_string: Optional[str] = None,
+ new_string: Optional[str] = None,
insert_line: Optional[int] = None,
insert_text: Optional[str] = None,
old_path: Optional[str] = None,
@@ -882,11 +882,11 @@ class LettaCoreToolExecutor(ToolExecutor):
elif command == "str_replace":
if path is None:
raise ValueError("Error: path is required for str_replace command")
- if old_str is None:
- raise ValueError("Error: old_str is required for str_replace command")
- if new_str is None:
- raise ValueError("Error: new_str is required for str_replace command")
- return await self.memory_str_replace(agent_state, actor, path, old_str, new_str)
+ if old_string is None:
+ raise ValueError("Error: old_string is required for str_replace command")
+ if new_string is None:
+ raise ValueError("Error: new_string is required for str_replace command")
+ return await self.memory_str_replace(agent_state, actor, path, old_string, new_string)
elif command == "insert":
if path is None: