Skip to content

Commit ae484e8

Browse files
committed
refac
1 parent 56dc7c5 commit ae484e8

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

backend/open_webui/utils/tools.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,24 @@ def get_tools(
6969
elif auth_type == "session":
7070
token = request.state.token.credentials
7171

72-
async def tool_function(**args):
73-
return await execute_tool_server(
74-
token=token,
75-
url=tool_server_data["url"],
76-
name=function_name,
77-
params=args,
78-
server_data=tool_server_data,
79-
)
72+
def make_tool_function(function_name, token, tool_server_data):
73+
async def tool_function(**kwargs):
74+
print(
75+
f"Executing tool function {function_name} with params: {kwargs}"
76+
)
77+
return await execute_tool_server(
78+
token=token,
79+
url=tool_server_data["url"],
80+
name=function_name,
81+
params=kwargs,
82+
server_data=tool_server_data,
83+
)
84+
85+
return tool_function
86+
87+
tool_function = make_tool_function(
88+
function_name, token, tool_server_data
89+
)
8090

8191
callable = get_async_tool_function_and_apply_extra_params(
8292
tool_function,

0 commit comments

Comments
 (0)