Class ExampleTool
java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.ExampleTool
A tool that injects (few-shot) examples into the outgoing LLM request as system instructions.
Configuration (args) options for YAML:
- examples: Either a fully-qualified reference to a
BaseExampleProviderinstance (e.g.,com.example.MyExamples.INSTANCE) or a list of examples with fieldsinputandoutput(array of messages).
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class BaseTool
BaseTool.ToolArgsConfig, BaseTool.ToolConfig -
Method Summary
Modifier and TypeMethodDescriptionstatic ExampleTool.Builderbuilder()static ExampleToolOverload to match resolver which passes only ToolArgsConfig.static ExampleToolfromConfig(BaseTool.ToolArgsConfig args, String configAbsPath) Factory from YAML tool args.io.reactivex.rxjava3.core.CompletableprocessLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Processes the outgoingLlmRequest.Builder.Methods inherited from class BaseTool
customMetadata, declaration, description, fromConfig, longRunning, name, runAsync, setCustomMetadata
-
Method Details
-
processLlmRequest
public io.reactivex.rxjava3.core.Completable processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Description copied from class:BaseToolProcesses the outgoingLlmRequest.Builder.This implementation adds the current tool's
BaseTool.declaration()to theGenerateContentConfigwithin the builder. If a tool with function declarations already exists, the current tool's declaration is merged into it. Otherwise, a new tool definition with the current tool's declaration is created. The current tool itself is also added to the builder's internal list of tools. Override this method for processing the outgoing request.- Overrides:
processLlmRequestin classBaseTool
-
fromConfig
public static ExampleTool fromConfig(BaseTool.ToolArgsConfig args, String configAbsPath) throws ConfigAgentUtils.ConfigurationException Factory from YAML tool args. -
fromConfig
public static ExampleTool fromConfig(BaseTool.ToolArgsConfig args) throws ConfigAgentUtils.ConfigurationException Overload to match resolver which passes only ToolArgsConfig. -
builder
-