Skip to content

feat: add VertexRagRetrievalTool for Vertex AI RAG Engine grounding#277

Open
nuthalapativarun wants to merge 4 commits intogoogle:mainfrom
nuthalapativarun:feat/vertex-rag-retrieval-tool
Open

feat: add VertexRagRetrievalTool for Vertex AI RAG Engine grounding#277
nuthalapativarun wants to merge 4 commits intogoogle:mainfrom
nuthalapativarun:feat/vertex-rag-retrieval-tool

Conversation

@nuthalapativarun
Copy link
Copy Markdown
Contributor

Description

Closes #152

Adds VertexRagRetrievalTool, a new built-in tool that grounds model responses using a Vertex AI RAG corpus. Mirrors the pattern established by GoogleSearchTool — it modifies the LLM request config server-side via processLlmRequest and requires no local execution.

Key design decisions

  • One tool = one corpus: The Vertex AI RAG Engine backend only supports one corpus per ragResources array. Users who need multiple corpora should create multiple tool instances.
  • Follows GoogleSearchTool pattern: Extends BaseTool, overrides processLlmRequest, runAsync is a no-op.
  • Optional config: similarityTopK and vectorDistanceThreshold are optional; only set when provided.

Changes

  • core/src/tools/vertex_rag_retrieval_tool.ts — new VertexRagRetrievalTool class + VertexRagRetrievalToolConfig interface
  • core/src/common.ts — export VertexRagRetrievalTool and VertexRagRetrievalToolConfig
  • core/test/tools/vertex_rag_retrieval_tool_test.ts — 7 unit tests covering all config paths

Testing

npx vitest run core/test/tools/vertex_rag_retrieval_tool_test.ts
✓ 7 tests passed

Checklist

  • I've read the CONTRIBUTING.md guide
  • My code follows the code style of this project
  • I've added tests that prove my fix or feature works
  • All new and existing tests pass
  • I've updated documentation (TSDoc) as needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create VertexRagRetrievalTool

1 participant