fix optional args not present

This commit is contained in:
Michael Poluektov
2024-11-21 17:41:35 +00:00
parent 70838148e7
commit c03bfd141e
2 changed files with 2 additions and 1 deletions

View File

@@ -16,6 +16,8 @@ log = logging.getLogger(__name__)
def apply_extra_params_to_tool_function(
function: Callable, extra_params: dict
) -> Callable[..., Awaitable]:
sig = inspect.signature(function)
extra_params = {k: v for k, v in extra_params.items() if k in sig.parameters}
partial_func = partial(function, **extra_params)
if inspect.iscoroutinefunction(function):
update_wrapper(partial_func, function)