xiaohongshu
xiaohongshu
adk-rag-agent
Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.
Full skill instructions
Build agents that answer questions from document corpora using Vertex AI RAG Engine.
GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
RAG_CORPUS=projects/{PROJECT_ID}/locations/{LOCATION}/ragCorpora/{CORPUS_ID}
from google.adk import Agent
from google.adk.tools import VertexAiRagRetrieval
# Configure RAG retrieval tool
rag_tool = VertexAiRagRetrieval(
name="retrieve_docs",
description="Retrieve relevant documentation for the question",
rag_corpus=os.environ["RAG_CORPUS"],
similarity_top_k=10,
vector_distance_threshold=0.6,
)
# Create agent with RAG tool
agent = Agent(
name="rag_agent",
model="gemini-2.0-flash-001",
instruction=INSTRUCTION_PROMPT,
tools=[rag_tool],
)
INSTRUCTION_PROMPT = """
You are an AI assistant with access to a specialized document corpus.
RETRIEVAL:
- Use retrieve_docs for specific knowledge questions
- Skip retrieval for casual conversation
- Ask clarifying questions when intent is unclear
SCOPE:
- Only answer questions related to the corpus
- Say "I don't have information about that" for out-of-scope queries
CITATIONS:
- Always cite sources at the end of responses
- Format: [Title](url) or [Document Section](url)
- Consolidate multiple citations from the same source
"""
Create corpus via Vertex AI Console or SDK:
from vertexai.preview import rag
# Create corpus
corpus = rag.create_corpus(display_name="my-corpus")
# Import documents (PDF, TXT, HTML)
rag.import_files(
corpus_name=corpus.name,
paths=["gs://bucket/doc.pdf"], # or local files
chunk_size=512,
chunk_overlap=100,
)
| Parameter | Description | Default |
|---|---|---|
similarity_top_k | Max chunks to retrieve | 10 |
vector_distance_threshold | Min similarity (0-1, lower=stricter) | 0.6 |
chunk_size | Tokens per chunk at import | 512 |
chunk_overlap | Overlap between chunks | 100 |
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience