LLMService: remove old function call single argument

This commit is contained in:
Aleix Conchillo Flaqué
2026-03-30 14:16:18 -07:00
parent 7873159d0f
commit 340e58bf5c

View File

@@ -127,7 +127,6 @@ class FunctionCallRegistryItem:
function_name: Optional[str] function_name: Optional[str]
handler: FunctionCallHandler | "DirectFunctionWrapper" handler: FunctionCallHandler | "DirectFunctionWrapper"
cancel_on_interruption: bool cancel_on_interruption: bool
handler_deprecated: bool
timeout_secs: Optional[float] = None timeout_secs: Optional[float] = None
@@ -590,23 +589,12 @@ class LLMService(UserTurnCompletionLLMServiceMixin, AIService):
``function_call_timeout_secs`` for this specific function. Defaults to ``function_call_timeout_secs`` for this specific function. Defaults to
None, which uses the global timeout. None, which uses the global timeout.
""" """
signature = inspect.signature(handler)
handler_deprecated = len(signature.parameters) > 1
if handler_deprecated:
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"Function calls with parameters `(function_name, tool_call_id, arguments, llm, context, result_callback)` are deprecated, use a single `FunctionCallParams` parameter instead.",
DeprecationWarning,
)
# Registering a function with the function_name set to None will run # Registering a function with the function_name set to None will run
# that handler for all functions # that handler for all functions
self._functions[function_name] = FunctionCallRegistryItem( self._functions[function_name] = FunctionCallRegistryItem(
function_name=function_name, function_name=function_name,
handler=handler, handler=handler,
cancel_on_interruption=cancel_on_interruption, cancel_on_interruption=cancel_on_interruption,
handler_deprecated=handler_deprecated,
timeout_secs=timeout_secs, timeout_secs=timeout_secs,
) )
@@ -636,7 +624,6 @@ class LLMService(UserTurnCompletionLLMServiceMixin, AIService):
function_name=wrapper.name, function_name=wrapper.name,
handler=wrapper, handler=wrapper,
cancel_on_interruption=cancel_on_interruption, cancel_on_interruption=cancel_on_interruption,
handler_deprecated=False,
timeout_secs=timeout_secs, timeout_secs=timeout_secs,
) )
@@ -889,16 +876,6 @@ class LLMService(UserTurnCompletionLLMServiceMixin, AIService):
) )
else: else:
# Handler is a FunctionCallHandler # Handler is a FunctionCallHandler
if item.handler_deprecated:
await item.handler(
runner_item.function_name,
runner_item.tool_call_id,
runner_item.arguments,
self,
runner_item.context,
function_call_result_callback,
)
else:
params = FunctionCallParams( params = FunctionCallParams(
function_name=runner_item.function_name, function_name=runner_item.function_name,
tool_call_id=runner_item.tool_call_id, tool_call_id=runner_item.tool_call_id,