匠人学院 JR Academy
Skip to article
Learning guide
ChromaDB Guide

Build local and lightweight retrieval systems with ChromaDB, embeddings, and RAG workflows.

2 chapters·4 guides·Access varies by chapter
Quickstart
On this page

ChromaDB Quickstart

First insert two documents and retrieve a relevant result. A local client is enough to understand that loop before adding server infrastructure or external providers.

#Install and run a minimal example

bash
pip install chromadb
python
import chromadb client = chromadb.PersistentClient(path="./my_db") collection = client.get_or_create_collection(name="my_documents") collection.add( documents=["Apple makes the iPhone.", "Microsoft develops Windows."], metadatas=[{"source": "wiki"}, {"source": "wiki"}], ids=["id1", "id2"], ) results = collection.query(query_texts=["Who develops Windows?"], n_results=1) print(results)

The configured/default embedding function may download a local model. Confirm the environment and version requirements before running the example.

#Establish a baseline

Start with documents and metadata, confirm correct retrieval, then evaluate around twenty representative queries before selecting a custom embedding model.

#Storage modes

ModeClientUse
Temporarychromadb.Client()Tests or disposable scripts
Persistentchromadb.PersistentClient(path="./db")Local persisted data
Serverchromadb.HttpClient(host="localhost", port=8000)A separately operated service

The source shows a basic Docker server:

bash
docker pull chromadb/chroma docker run -p 8000:8000 chromadb/chroma

This is an illustrative start command, not a complete secure production deployment. Plan persistence, access and versioning for an actual service.

#Next step

Published by
JR Academy
Learning resources

Individual authors and reviewers are credited where recorded.

System Design

Core system design concepts and practical case studies

Learn the trade-offs and patterns that matter in technical interviews.

Open System Design →

Related Roadmaps

Done reading? Next steps