Star on GitHub
DocsGetting started

Quickstart

Generate an embedding, store it in a vector index and run your first similarity query — in about five minutes.

1. Install dependencies

We'll use OpenAI's embedding API and a local Chroma instance. Any other engine from the sidebar will work the same way.

bash
npm install openai chromadb

2. Generate an embedding

An embedding maps a chunk of text into a fixed-size float vector. Two embeddings are similar when the texts they came from are semantically close.

ts
import OpenAI from "openai";

const openai = new OpenAI();

const { data } = await openai.embeddings.create({
  model: "text-embedding-3-small",
  input: "Vector databases store high-dimensional embeddings.",
});

const vector = data[0].embedding; // number[1536]

3. Upsert into the index

ts
import { ChromaClient } from "chromadb";

const chroma = new ChromaClient();
const collection = await chroma.getOrCreateCollection({ name: "docs" });

await collection.add({
  ids: ["doc-1"],
  embeddings: [vector],
  metadatas: [{ source: "intro.md" }],
  documents: ["Vector databases store high-dimensional embeddings."],
});

4. Query by similarity

ts
const results = await collection.query({
  queryEmbeddings: [vector],
  nResults: 5,
});

console.log(results.documents);
That's the entire loop.
Every vector database — Pinecone, Weaviate, Qdrant, Milvus, pgvector — implements this same three-step interface: embed, upsert, query.