Package com.google.adk.tools
Class FunctionTool
java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.FunctionTool
- Direct Known Subclasses:
ComputerUseTool,LoadMemoryTool,LongRunningFunctionTool
FunctionTool implements a customized function calling tool.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.adk.tools.BaseTool
BaseTool.ToolArgsConfig, BaseTool.ToolConfig -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFunctionTool(Object instance, Method func, boolean isLongRunning) protectedFunctionTool(Object instance, Method func, boolean isLongRunning, boolean requireConfirmation) protectedFunctionTool(Object instance, Method func, boolean isLongRunning, boolean requireConfirmation, com.fasterxml.jackson.databind.ObjectMapper objectMapper) protectedFunctionTool(Object instance, Method func, boolean isLongRunning, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptioncallLive(Map<String, Object> args, ToolContext toolContext, InvocationContext invocationContext) static FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolstatic FunctionToolOptional<com.google.genai.types.FunctionDeclaration>Gets theFunctionDeclarationrepresentation of this tool.func()Returns the underlying functionMethod.booleanReturns true if the wrapped function returns a Flowable and can be used for streaming.runAsync(Map<String, Object> args, ToolContext toolContext) Calls a tool.Methods inherited from class com.google.adk.tools.BaseTool
customMetadata, description, fromConfig, longRunning, name, processLlmRequest, setCustomMetadata
-
Constructor Details
-
FunctionTool
-
FunctionTool
-
FunctionTool
-
FunctionTool
-
-
Method Details
-
create
-
create
-
create
public static FunctionTool create(Object instance, Method func, boolean requireConfirmation, boolean isLongRunning) -
create
-
create
-
create
-
create
-
create
-
create
public static FunctionTool create(Class<?> cls, String methodName, boolean requireConfirmation, boolean isLongRunning) -
create
-
create
-
create
public static FunctionTool create(Object instance, String methodName, boolean requireConfirmation, boolean isLongRunning) -
declaration
Description copied from class:BaseToolGets theFunctionDeclarationrepresentation of this tool.- Overrides:
declarationin classBaseTool
-
func
Returns the underlying functionMethod. -
isStreaming
public boolean isStreaming()Returns true if the wrapped function returns a Flowable and can be used for streaming. -
runAsync
public io.reactivex.rxjava3.core.Single<Map<String,Object>> runAsync(Map<String, Object> args, ToolContext toolContext) Description copied from class:BaseToolCalls a tool. -
callLive
public io.reactivex.rxjava3.core.Flowable<Map<String,Object>> callLive(Map<String, Object> args, ToolContext toolContext, InvocationContext invocationContext) throws IllegalAccessException, InvocationTargetException
-