|
|
@@ -85,9 +85,26 @@ def get_async_tool_function_and_apply_extra_params(
|
|
|
update_wrapper(new_function, function)
|
|
|
new_function.__signature__ = new_sig
|
|
|
|
|
|
+ new_function.__function__ = function # type: ignore
|
|
|
+ new_function.__extra_params__ = extra_params # type: ignore
|
|
|
+
|
|
|
return new_function
|
|
|
|
|
|
|
|
|
+async def get_updated_tool_function(function: Callable, extra_params: dict):
|
|
|
+ # Get the original function and merge updated params
|
|
|
+ __function__ = getattr(function, "__function__", None)
|
|
|
+ __extra_params__ = getattr(function, "__extra_params__", None)
|
|
|
+
|
|
|
+ if __function__ is not None and __extra_params__ is not None:
|
|
|
+ return await get_async_tool_function_and_apply_extra_params(
|
|
|
+ __function__,
|
|
|
+ {**__extra_params__, **extra_params},
|
|
|
+ )
|
|
|
+
|
|
|
+ return function
|
|
|
+
|
|
|
+
|
|
|
async def get_tools(
|
|
|
request: Request, tool_ids: list[str], user: UserModel, extra_params: dict
|
|
|
) -> dict[str, dict]:
|