Skip to content

ChromaDB Discussion Points

Illustration for ChromaDB

These are common ChromaDB questions and answers, useful for interviews or when you first build a retrieval-augmented generation (RAG) app. Checked against the Chroma documentation in October 2026.

What is ChromaDB?

ChromaDB is an open-source, lightweight, and local-first vector database used to store embeddings and perform similarity search. It powers RAG systems by enabling fast retrieval of semantically similar text or data.

What are embeddings in ChromaDB?

Embeddings are high-dimensional numerical vectors representing text, images, audio, or structured data. They allow semantic operations like similarity search.

What is a collection in ChromaDB?

A collection is like a table containing:

  • embeddings
  • documents
  • metadata
  • unique IDs

You group related items into collections.

What distance metrics does ChromaDB support?

  • Squared Euclidean (L2) — the default
  • Cosine
  • Inner product (ip)

You choose the metric when you create the collection. Many text embedding models work best with cosine:

collection = client.create_collection(
    name="my_collection",
    configuration={"hnsw": {"space": "cosine"}}
)

How do you create a collection in ChromaDB?

import chromadb
client = chromadb.Client()
collection = client.create_collection("my_collection")

What is an embedding function?

It converts text/data into vectors before storing. ChromaDB supports embedding models from:

  • HuggingFace
  • OpenAI
  • SentenceTransformers

Why is ChromaDB used in RAG (Retrieval-Augmented Generation)?

Because it is:

  • Quick to set up: pip install chromadb and you can start
  • Easy to deploy
  • Supports metadata filtering
  • A good fit for prototypes and small to mid-sized RAG apps

How do you insert items into a ChromaDB collection?

collection.add(
    ids=["1"],
    documents=["Apple is a fruit"],
    metadatas=[{"type": "fruit"}]
)

How do you perform a similarity search in ChromaDB?

collection.query(query_texts=["What is Apple?"], n_results=3)

What is metadata filtering?

It allows narrowing down search results based on metadata fields.

collection.query(
    query_texts=["apple"],
    where={"type": "fruit"}
)

Difference between Client() and PersistentClient()?

ClientPersistentClient
In-memoryDisk-based
Data lost on restartSaves data to a folder on disk
Good for testingGood for production
import chromadb
client = chromadb.PersistentClient(path="./chroma_data")
collection = client.get_or_create_collection("my_collection")

What happens if you insert an existing ID?

add() does not overwrite an ID that already exists. Chroma skips it and logs a warning. To replace or create in one step, use upsert(). To change an existing item only, use update().

collection.upsert(
    ids=["1"],
    documents=["Apple is a fruit and a company"],
    metadatas=[{"type": "fruit"}]
)

What storage engine powers ChromaDB?

Since version 0.4, local Chroma stores documents and metadata in SQLite and keeps vectors in an HNSW index for fast nearest-neighbour search. Older versions (before mid-2023) used DuckDB and Parquet, which is why you still see DuckDB in older tutorials.

Does ChromaDB support hybrid search (keyword + vector search)?

Partly. Chroma can filter on document text with where_document (for example {"$contains": "apple"}), and Chroma now offers sparse vectors (BM25, SPLADE) and hybrid search through its newer Search API, shown mainly for Chroma Cloud. Check the sparse vector search page for what your version supports.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

One short email when a new calculator or article goes live. No spam, and you can unsubscribe in one click.