MCPcopy Index your code
hub / github.com/google/adk-python / _invoke_callable

Method _invoke_callable

src/google/adk/tools/function_tool.py:283–298  ·  view source on GitHub ↗

Invokes a callable, handling both sync and async cases.

(
      self, target: Callable[..., Any], args_to_call: dict[str, Any]
  )

Source from the content-addressed store, hash-verified

281 return None
282
283 async def _invoke_callable(
284 self, target: Callable[..., Any], args_to_call: dict[str, Any]
285 ) -> Any:
286 """Invokes a callable, handling both sync and async cases."""
287
288 # Functions are callable objects, but not all callable objects are functions
289 # checking coroutine function is not enough. We also need to check whether
290 # Callable's __call__ function is a coroutine function
291 is_async = inspect.iscoroutinefunction(target) or (
292 hasattr(target, '__call__')
293 and inspect.iscoroutinefunction(target.__call__)
294 )
295 if is_async:
296 return await target(**args_to_call)
297 else:
298 return target(**args_to_call)
299
300 # TODO: fix call live for function stream.
301 async def _call_live(

Callers 1

run_asyncMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected