File Processing

Pattern

Local RAG Chat

Load a sample Local RAG index, rank chunks in the browser, and stream a cited answer without a vector database.

IntermediateAug 2026View the full pattern on desktop
Local RAG Chat preview

Problems solved

  • Import a portable embedding index and chat over it in the browser
  • Rank local vectors with AI SDK Core cosineSimilarity
  • Stream cited answers from bounded selected text without a vector database

Use cases

  • Query a portable documentation index without a database
  • Local RAG demos and workshops
  • Cited chat over an exported embedding JSON file

AI SDK APIs

embedcosineSimilaritystreamTextsafeValidateUIMessagesconvertToModelMessagescreateUIMessageStreamtoUIMessageStreamcreateUIMessageStreamResponse

Tags

raglocal-ragchat-with-documentssimilarity-searchcitationsembeddingsjsonai-sdk

Requirements

Node.js
24+
Memory
256MB
Other
  • Vercel AI Gateway API key
  • A completed local-rag-ingest JSON export

Environment variables

External services

vercel-ai-gatewayupstash

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View the pattern on desktop

Related patterns