Merge pull request #904 from harshalmore31/bugfix/Multi-Modal-+-Function-Calling-Agents

bug fix: enhance error handling for multi-modal execution
pull/903/merge
Kye Gomez 7 days ago committed by GitHub
commit a9ae4cd222
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2256,14 +2256,18 @@ class BaseTool(BaseModel):
try:
api_response = json.loads(api_response)
except json.JSONDecodeError as e:
raise ToolValidationError(
f"Invalid JSON in API response: {e}"
) from e
self._log_if_verbose(
"error",
f"Failed to parse JSON from API response: {e}. Response: '{api_response[:100]}...'"
)
return []
if not isinstance(api_response, dict):
raise ToolValidationError(
"API response must be a dictionary, JSON string, BaseModel, or list of tool calls"
self._log_if_verbose(
"warning",
f"API response is not a dictionary (type: {type(api_response)}), returning empty list"
)
return []
# Extract function calls from dictionary response
function_calls = (

Loading…
Cancel
Save