AI Labs
All examples

Policy Q&A with Seed RAG on Vercel

Keyword retrieval over in-app policy seeds, then grounded answers via the Vercel AI SDK.

RAGGovernance

Target outcomes

  • Citation rate ≥ 90% on policy questions in pilot
  • Unknown-answer rate visible when retrieval returns no hits

Initiative playbook

Typical delivery arc for this pattern in enterprise programs.

  1. 1
    Discovery2 to 4 wks

    Inventory policy corpora and citation requirements; agree on unknown-answer behaviour when retrieval is empty.

  2. 2
    Pilot6 to 8 wks

    Ship seed RAG to HR/compliance reviewers; measure citation rate and override frequency.

  3. 3
    Scaleongoing

    Replace keyword search with managed vector index; keep document IDs stable for audit.

Business use case

Problem

Teams want a governed Q&A assistant before they stand up vector infrastructure. Pilots still need citations and honest “I don’t know” behaviour.

Who benefits

  • Compliance & legal, answers tied to named policy documents
  • HR / IT, self-serve policy questions without ticket volume
  • Platform engineering, a Vercel-native pattern that swaps seed search for Azure AI Search or pgvector later

Success metrics

  • ≥ 90% of pilot answers include at least one cited document title
  • “Unknown” rate tracked when retrieval returns no hits
  • Time-to-first-demo under two weeks using seed corpora

Solution

Retrieve top policy chunks with keyword scoring over shared seed documents, then call generateText with cite-only instructions. Same seeds power Azure and AWS examples for apples-to-apples comparisons.

Technical implementation

Stack

  • AI SDK generateText
  • Shared seeds in lib/demos/seed-documents.ts
  • OpenAI or AI Gateway via getVercelLanguageModel()

Architecture

Lightweight RAG on Vercel, retrieve from seeds, generate with strict cite-only instructions.

How it runs
Drawing the flow…

Outcomes and learnings

Prove grounding and citation discipline on seeds before you pay for embeddings and index ops.

  • Keyword search is enough for pilot governance conversations
  • Return retrieval metadata so reviewers know when answers are under-informed
  • Unify document IDs across clouds before production indexing

Where else this applies

Lightweight retrieval plus cite-only generation is the right first step wherever answers must be tied to approved text, not model memory.

HR and people policies

Benefits, leave, and conduct questions with citations to the employee handbook.

Security standards

Developers ask about approved libraries and data handling; answers link to internal standards pages.

Sales enablement

Competitive battlecards and pricing guardrails grounded in official GTM docs.

Manufacturing SOPs

Operators query maintenance procedures on the plant floor with source IDs for audit.

Using this stack elsewhere

Start on Vercel with seed or keyword search; graduate to pgvector, Turbopuffer, or an enterprise search index without changing the API contract shown here.

Live demo

The demo is the same code path described above, not a simplified mock UI. Add keys in .env.local when you are ready; the narrative and diagrams stand on their own without them.

Business

Ask a policy question and check whether answers cite the seed docs, or admit when retrieval found nothing.

Technical

searchSeedDocuments + generateText via getVercelLanguageModel(); returns sources and retrieval mode.

Seed-document RAG on Vercel

Keyword retrieval over in-app policy seeds, then grounded generation via AI SDK.

Live