mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-13 03:52:00 +00:00
fix(model_tools): log plugin hook exceptions instead of silently swallowing them
This commit is contained in:
parent
fe4748ede8
commit
61d9e3366d
1 changed files with 6 additions and 6 deletions
|
|
@ -730,8 +730,8 @@ def handle_function_call(
|
||||||
session_id=session_id or "",
|
session_id=session_id or "",
|
||||||
tool_call_id=tool_call_id or "",
|
tool_call_id=tool_call_id or "",
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception as _hook_err:
|
||||||
pass
|
logger.debug("pre_tool_call hook error: %s", _hook_err)
|
||||||
|
|
||||||
if block_message is not None:
|
if block_message is not None:
|
||||||
return json.dumps({"error": block_message}, ensure_ascii=False)
|
return json.dumps({"error": block_message}, ensure_ascii=False)
|
||||||
|
|
@ -782,8 +782,8 @@ def handle_function_call(
|
||||||
tool_call_id=tool_call_id or "",
|
tool_call_id=tool_call_id or "",
|
||||||
duration_ms=duration_ms,
|
duration_ms=duration_ms,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception as _hook_err:
|
||||||
pass
|
logger.debug("post_tool_call hook error: %s", _hook_err)
|
||||||
|
|
||||||
# Generic tool-result canonicalization seam: plugins receive the
|
# Generic tool-result canonicalization seam: plugins receive the
|
||||||
# final result string (JSON, usually) and may replace it by
|
# final result string (JSON, usually) and may replace it by
|
||||||
|
|
@ -807,8 +807,8 @@ def handle_function_call(
|
||||||
if isinstance(hook_result, str):
|
if isinstance(hook_result, str):
|
||||||
result = hook_result
|
result = hook_result
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception as _hook_err:
|
||||||
pass
|
logger.debug("transform_tool_result hook error: %s", _hook_err)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue