Class LoadArtifactsTool

java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.LoadArtifactsTool

public final class LoadArtifactsTool extends BaseTool
A tool that loads artifacts and adds them to the session.

This tool informs the model about available artifacts and provides their content when requested by the model through a function call.

  • Constructor Details

    • LoadArtifactsTool

      public LoadArtifactsTool()
  • Method Details

    • declaration

      public Optional<com.google.genai.types.FunctionDeclaration> declaration()
      Description copied from class: BaseTool
      Gets the FunctionDeclaration representation of this tool.
      Overrides:
      declaration in class BaseTool
    • runAsync

      public io.reactivex.rxjava3.core.Single<Map<String,Object>> runAsync(Map<String,Object> args, ToolContext toolContext)
      Description copied from class: BaseTool
      Calls a tool.
      Overrides:
      runAsync in class BaseTool
    • processLlmRequest

      public io.reactivex.rxjava3.core.Completable processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext)
      Description copied from class: BaseTool
      Processes the outgoing LlmRequest.Builder.

      This implementation adds the current tool's BaseTool.declaration() to the GenerateContentConfig within 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:
      processLlmRequest in class BaseTool
    • appendArtifactsToLlmRequest

      public io.reactivex.rxjava3.core.Completable appendArtifactsToLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext)