Skip to main content
Get up and running with Chroma in minutes. This guide will walk you through installing Chroma and creating your first vector database.

Installation

pip install chromadb

Basic example

import chromadb

# Create a Chroma client
client = chromadb.Client()

# Create a collection
collection = client.create_collection(name="my_collection")

# Add documents
collection.add(
    documents=[
        "This is a document about pineapple",
        "This is a document about oranges"
    ],
    ids=["id1", "id2"]
)

# Query the collection
results = collection.query(
    query_texts=["This is a query about fruit"],
    n_results=2
)

print(results)

Expected output

{
  'ids': [['id1', 'id2']],
  'distances': [[1.0, 1.2]],
  'documents': [['This is a document about pineapple', 
                 'This is a document about oranges']],
  'metadatas': [[None, None]]
}
Chroma automatically:
  • Generates embeddings using the default model
  • Stores embeddings in the collection
  • Finds the most similar documents when you query

What’s happening?

1

Create a client

The client connects to Chroma. By default, it runs in-memory for quick prototyping.
2

Create a collection

Collections store your embeddings, documents, and metadata.
3

Add documents

Chroma automatically generates embeddings for your documents using the default embedding function.
4

Query

Query with natural language. Chroma finds the most similar documents using vector similarity search.

Client types

Choose the right client for your use case:
import chromadb

# Ephemeral client - data is cleared when program exits
client = chromadb.Client()
Perfect for: Testing, prototyping, Jupyter notebooks

Next steps

Core Concepts

Learn about collections, embeddings, and metadata

Embedding Functions

Use OpenAI, Cohere, or custom embeddings

Filtering

Filter results using metadata

Deployment

Deploy Chroma to production

Build docs developers (and LLMs) love