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: Add `return_char_limit` to `ToolUpdate` (#557)

Matthew Zhoub7d3ae2a6590
diff --git a/letta/schemas/tool.py b/letta/schemas/tool.py
index 32f6a8af3..40a8fbf30 100644
--- a/letta/schemas/tool.py
+++ b/letta/schemas/tool.py
@@ -206,6 +206,7 @@ class ToolUpdate(LettaBase):
json_schema: Optional[Dict] = Field(
None, description="The JSON schema of the function (auto-generated from source_code if not provided)"
)
+ return_char_limit: Optional[int] = Field(None, description="The maximum number of characters in the response.")
class Config:
extra = "ignore" # Allows extra fields without validation errors
diff --git a/tests/test_managers.py b/tests/test_managers.py
index f1b2c621e..44afd991b 100644
--- a/tests/test_managers.py
+++ b/tests/test_managers.py
@@ -1391,9 +1391,10 @@ def test_list_tools(server: SyncServer, print_tool, default_user):
def test_update_tool_by_id(server: SyncServer, print_tool, default_user):
updated_description = "updated_description"
+ return_char_limit = 10000
# Create a ToolUpdate object to modify the print_tool's description
- tool_update = ToolUpdate(description=updated_description)
+ tool_update = ToolUpdate(description=updated_description, return_char_limit=return_char_limit)
# Update the tool using the manager method
server.tool_manager.update_tool_by_id(print_tool.id, tool_update, actor=default_user)
@@ -1403,6 +1404,7 @@ def test_update_tool_by_id(server: SyncServer, print_tool, default_user):
# Assertions to check if the update was successful
assert updated_tool.description == updated_description
+ assert updated_tool.return_char_limit == return_char_limit
def test_update_tool_source_code_refreshes_schema_and_name(server: SyncServer, print_tool, default_user):