Why this stack
Claude for reasoning + Pinecone for vector storage + Voyage AI for embeddings is the tightest RAG loop in 2026. Voyage embeddings outperform OpenAI's ada-002 on most retrieval benchmarks, Pinecone serverless costs pennies for a demo-scale index, and Claude's citations feature lands references inline with the response — no post-processing needed.
Step 1 — Chunk your documents
Split your source PDFs / markdown into ~500-token chunks with ~50-token overlap. Use langchain-text-splitters or roll your own with a simple sentence-boundary split. Store each chunk's source page in a metadata field so citations can point back.
Step 2 — Embed with Voyage
import { VoyageAIClient } from 'voyageai';
const voyage = new VoyageAIClient({ apiKey: process.env.VOYAGE_API_KEY });
const vecs = await voyage.embed({ input: chunks, model: 'voyage-3' });
Voyage-3 outputs 1024-dim embeddings. Batch up to 128 chunks per call.
Step 3 — Upsert to Pinecone
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone({ apiKey: process.env.PINECONE_API_KEY });
const idx = pc.index('my-docs');
await idx.upsert(chunks.map((c, i) => ({ id: `${c.docId}-${i}`, values: vecs.data[i].embedding, metadata: { text: c.text, source: c.source } })));
Step 4 — Retrieve + generate
At query time: embed the query, top-k from Pinecone (k=5-10 is a good default), stuff results into Claude's context with an instruction to cite:
const results = await idx.query({ vector: qEmbedding, topK: 8, includeMetadata: true });
const context = results.matches.map(m => `[${m.metadata.source}] ${m.metadata.text}`).join('\n\n');
const resp = await anthropic.messages.create({
model: 'claude-sonnet-5',
max_tokens: 1024,
messages: [{ role: 'user', content: `Answer using ONLY the sources below. Cite each claim.\n\nSources:\n${context}\n\nQuestion: ${query}` }],
});
When this stack falls short
Skip this for datasets under ~500 chunks — a keyword index (Meilisearch, Typesense) will be simpler + faster. Skip it for datasets over a few million chunks — you'll want hybrid search (Weaviate, Vespa) with reranking (Cohere Rerank).