From b7d3ae2a65907736f5dc790a593e5ec4e4102d7c Mon Sep 17 00:00:00 2001 From: Matthew Zhou Date: Wed, 8 Jan 2025 14:30:31 -1000 Subject: [PATCH] feat: Add `return_char_limit` to `ToolUpdate` (#557) --- letta/schemas/tool.py | 1 + tests/test_managers.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/letta/schemas/tool.py b/letta/schemas/tool.py index 32f6a8af..40a8fbf3 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 f1b2c621..44afd991 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):