fix(memory): standardize tool parameter names (#9552)
fix(memory): standardize tool parameter names
Use old_string/new_string across memory edit tools, docs, tests, and starter kits to avoid mismatched parameter names.
👾 Generated with [Letta Code](https://letta.com)
Co-Authored-By: Letta <noreply@letta.com>
EOF
)
This commit is contained in:
@@ -276,19 +276,19 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"old_str": {
|
||||
"old_string": {
|
||||
"type": "string",
|
||||
"description": "The text to replace (must match exactly, including whitespace and indentation)."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The new text to insert in place of the old text. Do not include line number prefixes."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"old_str",
|
||||
"new_str"
|
||||
"old_string",
|
||||
"new_string"
|
||||
]
|
||||
},
|
||||
"type": null,
|
||||
@@ -319,7 +319,7 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The text to insert. Do not include line number prefixes."
|
||||
},
|
||||
@@ -330,7 +330,7 @@
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"new_str"
|
||||
"new_string"
|
||||
]
|
||||
},
|
||||
"type": null,
|
||||
|
||||
@@ -799,7 +799,7 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The text to insert."
|
||||
},
|
||||
@@ -810,7 +810,7 @@
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"new_str"
|
||||
"new_string"
|
||||
]
|
||||
},
|
||||
"type": null,
|
||||
@@ -911,19 +911,19 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"old_str": {
|
||||
"old_string": {
|
||||
"type": "string",
|
||||
"description": "The text to replace (must match exactly, including whitespace and indentation)."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The new text to insert in place of the old text. Do not include line number prefixes."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"old_str",
|
||||
"new_str"
|
||||
"old_string",
|
||||
"new_string"
|
||||
]
|
||||
},
|
||||
"type": null,
|
||||
|
||||
@@ -1678,7 +1678,7 @@
|
||||
{
|
||||
"id": "tool-5",
|
||||
"tool_type": "letta_memory_core",
|
||||
"description": "Memory management tool with various sub-commands for memory block operations.\n\nExamples:\n # Replace text in a memory block\n memory(agent_state, \"str_replace\", path=\"/memories/user_preferences\", old_str=\"theme: dark\", new_str=\"theme: light\")\n\n # Insert text at line 5\n memory(agent_state, \"insert\", path=\"/memories/notes\", insert_line=5, insert_text=\"New note here\")\n\n # Delete a memory block\n memory(agent_state, \"delete\", path=\"/memories/old_notes\")\n\n # Rename a memory block\n memory(agent_state, \"rename\", old_path=\"/memories/temp\", new_path=\"/memories/permanent\")\n\n # Update the description of a memory block\n memory(agent_state, \"rename\", path=\"/memories/temp\", description=\"The user's temporary notes.\")\n\n # Create a memory block with starting text\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\", \"file_text\": \"The user seems to add type hints to all of their Python code.\")\n\n # Create an empty memory block\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\")",
|
||||
"description": "Memory management tool with various sub-commands for memory block operations.\n\nExamples:\n # Replace text in a memory block\n memory(agent_state, \"str_replace\", path=\"/memories/user_preferences\", old_string=\"theme: dark\", new_string=\"theme: light\")\n\n # Insert text at line 5\n memory(agent_state, \"insert\", path=\"/memories/notes\", insert_line=5, insert_text=\"New note here\")\n\n # Delete a memory block\n memory(agent_state, \"delete\", path=\"/memories/old_notes\")\n\n # Rename a memory block\n memory(agent_state, \"rename\", old_path=\"/memories/temp\", new_path=\"/memories/permanent\")\n\n # Update the description of a memory block\n memory(agent_state, \"rename\", path=\"/memories/temp\", description=\"The user's temporary notes.\")\n\n # Create a memory block with starting text\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\", \"file_text\": \"The user seems to add type hints to all of their Python code.\")\n\n # Create an empty memory block\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\")",
|
||||
"source_type": "python",
|
||||
"name": "memory",
|
||||
"tags": [
|
||||
@@ -1687,7 +1687,7 @@
|
||||
"source_code": null,
|
||||
"json_schema": {
|
||||
"name": "memory",
|
||||
"description": "Memory management tool with various sub-commands for memory block operations.\n\nExamples:\n # Replace text in a memory block\n memory(agent_state, \"str_replace\", path=\"/memories/user_preferences\", old_str=\"theme: dark\", new_str=\"theme: light\")\n\n # Insert text at line 5\n memory(agent_state, \"insert\", path=\"/memories/notes\", insert_line=5, insert_text=\"New note here\")\n\n # Delete a memory block\n memory(agent_state, \"delete\", path=\"/memories/old_notes\")\n\n # Rename a memory block\n memory(agent_state, \"rename\", old_path=\"/memories/temp\", new_path=\"/memories/permanent\")\n\n # Update the description of a memory block\n memory(agent_state, \"rename\", path=\"/memories/temp\", description=\"The user's temporary notes.\")\n\n # Create a memory block with starting text\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\", \"file_text\": \"The user seems to add type hints to all of their Python code.\")\n\n # Create an empty memory block\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\")",
|
||||
"description": "Memory management tool with various sub-commands for memory block operations.\n\nExamples:\n # Replace text in a memory block\n memory(agent_state, \"str_replace\", path=\"/memories/user_preferences\", old_string=\"theme: dark\", new_string=\"theme: light\")\n\n # Insert text at line 5\n memory(agent_state, \"insert\", path=\"/memories/notes\", insert_line=5, insert_text=\"New note here\")\n\n # Delete a memory block\n memory(agent_state, \"delete\", path=\"/memories/old_notes\")\n\n # Rename a memory block\n memory(agent_state, \"rename\", old_path=\"/memories/temp\", new_path=\"/memories/permanent\")\n\n # Update the description of a memory block\n memory(agent_state, \"rename\", path=\"/memories/temp\", description=\"The user's temporary notes.\")\n\n # Create a memory block with starting text\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\", \"file_text\": \"The user seems to add type hints to all of their Python code.\")\n\n # Create an empty memory block\n memory(agent_state, \"create\", path=\"/memories/coding_preferences\", \"description\": \"The user's coding preferences.\")",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1707,11 +1707,11 @@
|
||||
"type": "string",
|
||||
"description": "The description to set in the memory block (for create, rename)"
|
||||
},
|
||||
"old_str": {
|
||||
"old_string": {
|
||||
"type": "string",
|
||||
"description": "Old text to replace (for str_replace)"
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "New text to replace with (for str_replace)"
|
||||
},
|
||||
|
||||
@@ -514,7 +514,7 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The text to insert. Do not include line number prefixes."
|
||||
},
|
||||
@@ -525,7 +525,7 @@
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"new_str"
|
||||
"new_string"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -557,19 +557,19 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"old_str": {
|
||||
"old_string": {
|
||||
"type": "string",
|
||||
"description": "The text to replace (must match exactly, including whitespace and indentation)."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The new text to insert in place of the old text. Do not include line number prefixes."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"old_str",
|
||||
"new_str"
|
||||
"old_string",
|
||||
"new_string"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -574,7 +574,7 @@
|
||||
{
|
||||
"id": "tool-6",
|
||||
"tool_type": "letta_sleeptime_core",
|
||||
"description": "The memory_insert command allows you to insert text at a specific location in a memory block.\n\nExamples:\n # Update a block containing information about the user (append to the end of the block)\n memory_insert(label=\"customer\", new_str=\"The customer's ticket number is 12345\")\n\n # Update a block containing information about the user (insert at the beginning of the block)\n memory_insert(label=\"customer\", new_str=\"The customer's ticket number is 12345\", insert_line=0)\n\n Returns:\n Optional[str]: None is always returned as this function does not produce a response.",
|
||||
"description": "The memory_insert command allows you to insert text at a specific location in a memory block.\n\nExamples:\n # Update a block containing information about the user (append to the end of the block)\n memory_insert(label=\"customer\", new_string=\"The customer's ticket number is 12345\")\n\n # Update a block containing information about the user (insert at the beginning of the block)\n memory_insert(label=\"customer\", new_string=\"The customer's ticket number is 12345\", insert_line=0)\n\n Returns:\n Optional[str]: None is always returned as this function does not produce a response.",
|
||||
"source_type": "python",
|
||||
"name": "memory_insert",
|
||||
"tags": [
|
||||
@@ -583,7 +583,7 @@
|
||||
"source_code": null,
|
||||
"json_schema": {
|
||||
"name": "memory_insert",
|
||||
"description": "The memory_insert command allows you to insert text at a specific location in a memory block.\n\nExamples:\n # Update a block containing information about the user (append to the end of the block)\n memory_insert(label=\"customer\", new_str=\"The customer's ticket number is 12345\")\n\n # Update a block containing information about the user (insert at the beginning of the block)\n memory_insert(label=\"customer\", new_str=\"The customer's ticket number is 12345\", insert_line=0)\n\n Returns:\n Optional[str]: None is always returned as this function does not produce a response.",
|
||||
"description": "The memory_insert command allows you to insert text at a specific location in a memory block.\n\nExamples:\n # Update a block containing information about the user (append to the end of the block)\n memory_insert(label=\"customer\", new_string=\"The customer's ticket number is 12345\")\n\n # Update a block containing information about the user (insert at the beginning of the block)\n memory_insert(label=\"customer\", new_string=\"The customer's ticket number is 12345\", insert_line=0)\n\n Returns:\n Optional[str]: None is always returned as this function does not produce a response.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -591,7 +591,7 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The text to insert. Do not include line number prefixes."
|
||||
},
|
||||
@@ -602,7 +602,7 @@
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"new_str"
|
||||
"new_string"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -618,7 +618,7 @@
|
||||
{
|
||||
"id": "tool-1",
|
||||
"tool_type": "letta_sleeptime_core",
|
||||
"description": "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.\n\nExamples:\n # Update a block containing information about the user\n memory_replace(label=\"human\", old_str=\"Their name is Alice\", new_str=\"Their name is Bob\")\n\n # Update a block containing a todo list\n memory_replace(label=\"todos\", old_str=\"- [ ] Step 5: Search the web\", new_str=\"- [x] Step 5: Search the web\")\n\n # Pass an empty string to\n memory_replace(label=\"human\", old_str=\"Their name is Alice\", new_str=\"\")\n\n # Bad example - do NOT add (view-only) line numbers to the args\n memory_replace(label=\"human\", old_str=\"Line 1: Their name is Alice\", new_str=\"Line 1: Their name is Bob\")\n\n # Bad example - do NOT include the number number warning either\n memory_replace(label=\"human\", old_str=\"# NOTE: Line numbers shown below are to help during editing. Do NOT include line number prefixes in your memory edit tool calls.\\nLine 1: Their name is Alice\", new_str=\"Line 1: Their name is Bob\")\n\n # Good example - no line numbers or line number warning (they are view-only), just the text\n memory_replace(label=\"human\", old_str=\"Their name is Alice\", new_str=\"Their name is Bob\")\n\n Returns:\n str: The success message",
|
||||
"description": "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.\n\nExamples:\n # Update a block containing information about the user\n memory_replace(label=\"human\", old_string=\"Their name is Alice\", new_string=\"Their name is Bob\")\n\n # Update a block containing a todo list\n memory_replace(label=\"todos\", old_string=\"- [ ] Step 5: Search the web\", new_string=\"- [x] Step 5: Search the web\")\n\n # Pass an empty string to\n memory_replace(label=\"human\", old_string=\"Their name is Alice\", new_string=\"\")\n\n # Bad example - do NOT add (view-only) line numbers to the args\n memory_replace(label=\"human\", old_string=\"Line 1: Their name is Alice\", new_string=\"Line 1: Their name is Bob\")\n\n # Bad example - do NOT include the number number warning either\n memory_replace(label=\"human\", old_string=\"# NOTE: Line numbers shown below are to help during editing. Do NOT include line number prefixes in your memory edit tool calls.\\nLine 1: Their name is Alice\", new_string=\"Line 1: Their name is Bob\")\n\n # Good example - no line numbers or line number warning (they are view-only), just the text\n memory_replace(label=\"human\", old_string=\"Their name is Alice\", new_string=\"Their name is Bob\")\n\n Returns:\n str: The success message",
|
||||
"source_type": "python",
|
||||
"name": "memory_replace",
|
||||
"tags": [
|
||||
@@ -627,7 +627,7 @@
|
||||
"source_code": null,
|
||||
"json_schema": {
|
||||
"name": "memory_replace",
|
||||
"description": "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.\n\nExamples:\n # Update a block containing information about the user\n memory_replace(label=\"human\", old_str=\"Their name is Alice\", new_str=\"Their name is Bob\")\n\n # Update a block containing a todo list\n memory_replace(label=\"todos\", old_str=\"- [ ] Step 5: Search the web\", new_str=\"- [x] Step 5: Search the web\")\n\n # Pass an empty string to\n memory_replace(label=\"human\", old_str=\"Their name is Alice\", new_str=\"\")\n\n # Bad example - do NOT add (view-only) line numbers to the args\n memory_replace(label=\"human\", old_str=\"Line 1: Their name is Alice\", new_str=\"Line 1: Their name is Bob\")\n\n # Bad example - do NOT include the number number warning either\n memory_replace(label=\"human\", old_str=\"# NOTE: Line numbers shown below are to help during editing. Do NOT include line number prefixes in your memory edit tool calls.\\nLine 1: Their name is Alice\", new_str=\"Line 1: Their name is Bob\")\n\n # Good example - no line numbers or line number warning (they are view-only), just the text\n memory_replace(label=\"human\", old_str=\"Their name is Alice\", new_str=\"Their name is Bob\")\n\n Returns:\n str: The success message",
|
||||
"description": "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.\n\nExamples:\n # Update a block containing information about the user\n memory_replace(label=\"human\", old_string=\"Their name is Alice\", new_string=\"Their name is Bob\")\n\n # Update a block containing a todo list\n memory_replace(label=\"todos\", old_string=\"- [ ] Step 5: Search the web\", new_string=\"- [x] Step 5: Search the web\")\n\n # Pass an empty string to\n memory_replace(label=\"human\", old_string=\"Their name is Alice\", new_string=\"\")\n\n # Bad example - do NOT add (view-only) line numbers to the args\n memory_replace(label=\"human\", old_string=\"Line 1: Their name is Alice\", new_string=\"Line 1: Their name is Bob\")\n\n # Bad example - do NOT include the number number warning either\n memory_replace(label=\"human\", old_string=\"# NOTE: Line numbers shown below are to help during editing. Do NOT include line number prefixes in your memory edit tool calls.\\nLine 1: Their name is Alice\", new_string=\"Line 1: Their name is Bob\")\n\n # Good example - no line numbers or line number warning (they are view-only), just the text\n memory_replace(label=\"human\", old_string=\"Their name is Alice\", new_string=\"Their name is Bob\")\n\n Returns:\n str: The success message",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -635,19 +635,19 @@
|
||||
"type": "string",
|
||||
"description": "Section of the memory to be edited, identified by its label."
|
||||
},
|
||||
"old_str": {
|
||||
"old_string": {
|
||||
"type": "string",
|
||||
"description": "The text to replace (must match exactly, including whitespace and indentation)."
|
||||
},
|
||||
"new_str": {
|
||||
"new_string": {
|
||||
"type": "string",
|
||||
"description": "The new text to insert in place of the old text. Do not include line number prefixes."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"old_str",
|
||||
"new_str"
|
||||
"old_string",
|
||||
"new_string"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2438,7 +2438,7 @@ def test_calling_tools(client: LettaSDKClient, agent: AgentState) -> None:
|
||||
assert len(blocks) == 1, f"Expected 1 block, got {len(blocks)}"
|
||||
|
||||
# test calling a stateful tool
|
||||
result = client.agents.tools.run(agent_id=agent.id, tool_name="memory_insert", args={"label": "human", "new_str": "test"})
|
||||
result = client.agents.tools.run(agent_id=agent.id, tool_name="memory_insert", args={"label": "human", "new_string": "test"})
|
||||
assert result.status == "success", f"Expected success, got {result.status}"
|
||||
# get the block
|
||||
block = client.agents.blocks.retrieve(agent_id=agent.id, block_label="human")
|
||||
|
||||
Reference in New Issue
Block a user