Class VertexAiRagRetrieval
java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.retrieval.BaseRetrievalTool
com.google.adk.tools.retrieval.VertexAiRagRetrieval
A retrieval tool that fetches context from Vertex AI RAG.
This tool allows to retrieve relevant information based on a query using Vertex AI RAG service. It supports configuration of rag resources and a vector distance threshold.
-
Constructor Summary
ConstructorsConstructorDescriptionVertexAiRagRetrieval
(String name, String description, com.google.cloud.aiplatform.v1.VertexRagServiceClient vertexRagServiceClient, String parent, List<com.google.cloud.aiplatform.v1.RetrieveContextsRequest.VertexRagStore.RagResource> ragResources, Double vectorDistanceThreshold) -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Completable
processLlmRequest
(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Processes the outgoingLlmRequest.Builder
.runAsync
(Map<String, Object> args, ToolContext toolContext) Calls a tool.Methods inherited from class com.google.adk.tools.retrieval.BaseRetrievalTool
declaration
Methods inherited from class com.google.adk.tools.BaseTool
description, longRunning, name
-
Constructor Details
-
VertexAiRagRetrieval
public VertexAiRagRetrieval(@Nonnull String name, @Nonnull String description, @Nonnull com.google.cloud.aiplatform.v1.VertexRagServiceClient vertexRagServiceClient, @Nonnull String parent, @Nullable List<com.google.cloud.aiplatform.v1.RetrieveContextsRequest.VertexRagStore.RagResource> ragResources, @Nullable Double vectorDistanceThreshold)
-
-
Method Details
-
processLlmRequest
@CanIgnoreReturnValue public io.reactivex.rxjava3.core.Completable processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Description copied from class:BaseTool
Processes the outgoingLlmRequest.Builder
.This implementation adds the current tool's
BaseTool.declaration()
to theGenerateContentConfig
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 classBaseTool
-
runAsync
-