VertexAiRagClientTool

A client-side retrieval tool that fetches context from a Vertex AI RAG corpus.

Unlike VertexAiRagRetrieval, which grounds the model natively via vertexRagStore, this tool runs the retrieval itself: run queries the Vertex AI RAG service through a VertexAiRagClient and returns the matching context texts, so it works on any model as an ordinary function tool. The corpus and vectorDistanceThreshold are fixed per instance; the model supplies query and an optional similarityTopK per call.

Constructors

Link copied to clipboard
constructor(name: String, description: String, project: String, location: String, ragCorpus: String, vectorDistanceThreshold: Double? = null, credentials: GoogleCredentials = GoogleApiClient.defaultCredentials(), httpClient: HttpClient = HttpClient(Java))

Creates a tool that retrieves from the RAG corpus ragCorpus in project and location.

Types

Link copied to clipboard
class Builder

Fluent builder for VertexAiRagClientTool, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The custom metadata of the tool.

Link copied to clipboard

The description of the tool.

Link copied to clipboard

Whether the tool's final result will be delivered out-of-band. When true, the framework marks the call as long-running and uses the tool's return value as the function-response payload. Returning Unit means "no response yet": the FR event is suppressed so the function-call event (which carries the call id in longRunningToolIds and is thus the turn's final response) ends the turn without re-invoking the model. A non-Unit return -- including an explicit empty Map -- is treated as a real response and emitted. (Unit suppression aligns with Python; Java instead always emits {}.) The longRunningToolIds id also drives the resumable-mode pause gate so the invocation can be resumed later via a user-injected function-response.

Link copied to clipboard

The name of the tool.

Functions

Link copied to clipboard
fun BaseTool.asNode(name: String = this.name, config: NodeConfig = NodeConfig()): Node

Returns a workflow node that runs this tool as a fixed step: the predecessor's output becomes the tool's arguments, and the tool's result becomes the node's output.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun declaration(): FunctionDeclaration

Returns the underlying function declaration.

Link copied to clipboard
open suspend fun processLlmRequest(toolContext: ToolContext, llmRequest: LlmRequest): LlmRequest

Processes the LLM request before it is sent.

Link copied to clipboard
open suspend override fun run(context: ToolContext, args: Map<String, Any?>): Any

Executes the tool and returns its result.