feat: Add return_char_limit to ToolUpdate (#557)

This commit is contained in:
Matthew Zhou
2025-01-08 14:30:31 -10:00
committed by GitHub
parent 463491358d
commit b7d3ae2a65
2 changed files with 4 additions and 1 deletions

View File

@@ -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

View File

@@ -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):