tool_wrapper #5302
Unanswered
maoxiaomeng2021
asked this question in
Q&A
tool_wrapper
#5302
Replies: 1 comment
-
https://docs.python.org/3/library/functools.html#functools.wraps ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i want to create a tool_wrapper_fun to do sth extensional ,eg: just print sth or save log ,this is the code i :
`
def tool_log_recorder(*, func):
sfunc = StructuredTool.from_function(func=func)
`
and i use it by:
`
def add(a,b):
"""plus a and b"""
return a+b
agent = create_react_agent(
model=model,
tools=[
tool_log_recorder(func=add),
],
)
`
and it works;
but i want to get tool_call_id or other sth such as state, it it failed
i try it such as:
def tool_log_recorder(*, func, tool_call_id: Annotated[str, InjectedToolCallId] = None):
sfunc = StructuredTool.from_function(func=func)
it seems failed too ,
plz help me
Beta Was this translation helpful? Give feedback.
All reactions