ADK for TypeScript: API Reference
    Preparing search index...

    Class VertexRagRetrievalTool

    A tool that retrieves relevant content from a Vertex AI RAG corpus to ground model responses.

    This tool operates server-side; it modifies the LLM request config to enable RAG retrieval via the retrieval.vertexRagStore field and does not perform local code execution.

    Note: The Vertex AI RAG Engine only supports one corpus per ragResources array. Create one VertexRagRetrievalTool instance per corpus.

    import { VertexRagRetrievalTool } from '@google/adk';
    import { VertexRagStore } from '@google/genai';

    const ragTool = new VertexRagRetrievalTool({
    ragResources: [{ragCorpus: 'projects/my-project/locations/us-central1/ragCorpora/my-corpus'}],
    similarityTopK: 5,
    });

    const agent = new LlmAgent({ tools: [ragTool], ... });

    Hierarchy (View Summary)

    Constructors

    Properties

    "[BASE_TOOL_SIGNATURE_SYMBOL]": true

    A unique symbol to identify ADK base tool class.

    description: string
    isLongRunning: boolean
    name: string

    Accessors

    Methods

    • Gets the OpenAPI specification of this tool in the form of a FunctionDeclaration.

      NOTE

      • Required if subclass uses the default implementation of processLlmRequest to add function declaration to LLM request.
      • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

      Returns FunctionDeclaration | undefined

      The FunctionDeclaration of this tool, or undefined if it doesn't need to be added to LlmRequest.config.