File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,10 @@ class FunctionTool:
179179 and returns whether the tool is enabled. You can use this to dynamically enable/disable a tool
180180 based on your context/state."""
181181
182+ func : ToolFunction [...] | None = None
183+ """The function that implements the tool. Ensures that a reference to the original function exists
184+ when @function_tool is used."""
185+
182186 # Tool-specific guardrails
183187 tool_input_guardrails : list [ToolInputGuardrail [Any ]] | None = None
184188 """Optional list of input guardrails to run before invoking this tool."""
@@ -661,6 +665,7 @@ async def _on_invoke_tool(ctx: ToolContext[Any], input: str) -> Any:
661665 on_invoke_tool = _on_invoke_tool ,
662666 strict_json_schema = strict_mode ,
663667 is_enabled = is_enabled ,
668+ func = func
664669 )
665670
666671 # If func is actually a callable, we were used as @function_tool with no parentheses
You can’t perform that action at this time.
0 commit comments