From af1c8d69df48c3b1e47f569f0433272b776439f8 Mon Sep 17 00:00:00 2001 From: Shubham Naik Date: Mon, 24 Mar 2025 10:09:42 -0800 Subject: [PATCH] chore: do no brick list endpoint if jsons chema is invalid (#1380) Co-authored-by: Shubham Naik --- letta/schemas/tool.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/letta/schemas/tool.py b/letta/schemas/tool.py index 4f17540a..2ff62924 100644 --- a/letta/schemas/tool.py +++ b/letta/schemas/tool.py @@ -93,7 +93,11 @@ class Tool(BaseTool): description=description, ) else: - self.json_schema = derive_openai_json_schema(source_code=self.source_code) + try: + self.json_schema = derive_openai_json_schema(source_code=self.source_code) + except Exception as e: + error_msg = f"Failed to derive json schema for tool with id={self.id} name={self.name}. Error: {str(e)}" + logger.error(error_msg) elif self.tool_type in {ToolType.LETTA_CORE, ToolType.LETTA_MEMORY_CORE}: # If it's letta core tool, we generate the json_schema on the fly here self.json_schema = get_json_schema_from_module(module_name=LETTA_CORE_TOOL_MODULE_NAME, function_name=self.name)