1 min read 236 words Updated Sep 24, 2026 Created Sep 24, 2026
#Data#Database#vector

Open-source DB for vector, full-text and other things. Advocated as solid retrieval database for AI-driven applications. It is based on Sqlite, thus, the database is present as a file.

Alternatives to Chroma:

Chroma also has a CLI: https://docs.trychroma.com/docs/cli/install

SDK

Collections

Creating ones:

collection = client.get_or_create_collection(
    name="myDB",
    metadata={"hnsw:space": "cosine"},
    embedding_function=None
)

Metadata:

  • You can provide the distance metric used, using the hnsw:space metadata key. Support are L2, cosine and ip (inner product). Cosine will return cosine distance rather than cosine similarity. The default is the squared euclidean distance.

Adding documents

When adding documents with collection.add, Chroma can to the embedding work itself with the default embedding model. It uses all-MinLM-L6-v2 from SentenceTransformers.

Getting documents

collection.peek() is like df.head() and will return the first elements.

n_resultsfor collection.querycan be used to change the number of returned elements.

collection.querycan be used also for retrieving by metadata:

CLI

Vaccuuming

This process will reduce the size of your database:
Provide a path to the DB file to optimize it.

https://docs.trychroma.com/docs/cli/vacuum

Accessing a local DB running in the network: (important to type the host exactly like this)

chroma browse collection_name --host http://localhost:8000

You might want this in your actual docker container, which isn't forwardings its ports. Thus, spawn a shell to do this inside: Docker

Resources

The official cookbook: https://cookbook.chromadb.dev/

ChromaDB Cloud, has some generous pricing: https://www.trychroma.com/pricing