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


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
AI_GATEWAY_API_KEYGet key
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 desktopRelated patterns


Local RAG Ingest
Chunk local text, create embeddings, and export a portable RAG index without a vector database.
ragretrieval-augmented-generation+5
View pattern β


PDF Analysis Tool
Process PDFs with AI analysis. Extract text, generate summaries, and identify key insights.
aipdf+2
View pattern β



