Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: patch non-optional memory replace (#3803)
Sarah Wooders1ec1bfe31253
diff --git a/letta/functions/function_sets/base.py b/letta/functions/function_sets/base.pyindex de61c411d..233ce7a51 100644--- a/letta/functions/function_sets/base.py+++ b/letta/functions/function_sets/base.py@@ -191,14 +191,14 @@ SNIPPET_LINES: int = 4# Based off of: https://github.com/anthropics/anthropic-quickstarts/blob/main/computer-use-demo/computer_use_demo/tools/edit.py?ref=musings.yasyf.com#L154-def memory_replace(agent_state: "AgentState", label: str, old_str: str, new_str: Optional[str] = None) -> str: # type: ignore+def memory_replace(agent_state: "AgentState", label: str, old_str: str, new_str: str) -> str: # type: ignore"""The memory_replace command allows you to replace a specific string in a memory block with a new string. This is used for making precise edits.Args:label (str): Section of the memory to be edited, identified by its label.old_str (str): The text to replace (must match exactly, including whitespace and indentation).- new_str (Optional[str]): The new text to insert in place of the old text. Omit this argument to delete the old_str.+ new_str (str): The new text to insert in place of the old text. Do not include line number prefixes.Returns:str: The success messagediff --git a/letta/services/tool_executor/core_tool_executor.py b/letta/services/tool_executor/core_tool_executor.pyindex 1ef995d68..40398dcfd 100644--- a/letta/services/tool_executor/core_tool_executor.py+++ b/letta/services/tool_executor/core_tool_executor.py@@ -239,7 +239,7 @@ class LettaCoreToolExecutor(ToolExecutor):label (str): Section of the memory to be edited, identified by its label.old_str (str): The text to replace (must match exactly, including whitespaceand indentation). Do not include line number prefixes.- new_str (str): The new text to insert in place of the old text.+ new_str (str): The new text to insert in place of the old text. Do not include line number prefixes.Returns:str: The success message