mirror of
https://github.com/HKUDS/OpenSpace.git
synced 2026-09-09 22:31:03 +00:00
Improve error handling for tool argument parsing
Fixed the bare `except` issue (JSONDecodeError, ValueError, TypeError)
This commit is contained in:
parent
1cf7953d68
commit
0fe59515ca
1 changed files with 3 additions and 3 deletions
|
|
@ -650,8 +650,8 @@ class LLMClient:
|
|||
|
||||
args_str = json.dumps(args, ensure_ascii=False)[:200]
|
||||
self._logger.info(f"Calling {tool_name} with args: {args_str}")
|
||||
except:
|
||||
pass
|
||||
except (json.JSONDecodeError, ValueError, TypeError) as e:
|
||||
self._logger.debug(f"Failed to parse tool arguments for {tool_name}: {e}")
|
||||
|
||||
if tool_name not in tool_map:
|
||||
result = ToolResult(
|
||||
|
|
@ -766,4 +766,4 @@ class LLMClient:
|
|||
role = msg.get("role", "unknown").upper()
|
||||
content = msg.get("content", "")
|
||||
formatted += f"[{role}]\n{content}\n\n"
|
||||
return formatted
|
||||
return formatted
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue