RAG with Meridian
Embed documents, index them for similarity search, and pipe the top‑k chunks into a completion — all with a single pipeline definition.
Step 1
Embeddings
Chunk documents and compute embeddings via text-embedding-3-small. Vectors land in your Meridian‑managed index.
→
→
Step 2
Similarity Search
At query time, embed the user prompt and run ANN over your index. Top‑k chunks return with relevance scores.
→
→
Step 3
Completion
Stitch retrieved chunks into the system prompt and call gpt-4o. The model answers grounded in your data.
pipeline.ts
import { Meridian } from "@meridian/sdk";
const m = new Meridian({ apiKey: process.env.MERIDIAN_KEY });
const pipeline = m.pipeline("rag-demo")
.embed({ model: "text-embedding-3-small", source: "docs/" })
.index({ name: "knowledge-base", metric: "cosine" })
.retrieve({ k: 5, minScore: 0.7 })
.complete({ model: "gpt-4o", temperature: 0.2 });
const answer = await pipeline.run("What is the refund policy?");No credit card required · 10k embeddings free