What this thread does
Do first: Run pip install chromadb, then create a Python in-memory client.
Short answer
Chroma stores and embeds text automatically. Query with query_texts; n_results controls the returned match count.
What to do
| Step | Value / action |
|---|---|
| Install | pip install chromadb |
| Client | chromadb.Client(); in-memory |
| New collection | create_collection(name="my_collection") |
| Repeat runs | Replace create_collection with get_or_create_collection; replace add with upsert |
| Documents | documents plus unique string ids; example IDs id1, id2 |
| Search | collection.query(query_texts=[...], n_results=2); omitted n_results defaults to 10 |
| Inspect | Results include nested documents, ids and distances |
import chromadb
client = chromadb.Client()
collection = client.get_or_create_collection(name="my_collection")
collection.upsert(ids=["id1", "id2"], documents=["This is a document about pineapple", "This is a document about oranges"])
results = collection.query(query_texts=["This is a query document about hawaii"], n_results=2)
Limits and open questions
In-memory data disappears when the program exits. The guide points to a persistent client or client-server mode for persistence; this example configures neither. It does not pin a package version or specify an embedding-model identifier.
Not for: Weaviate Cloud collection imports.
Sources
- Chroma Getting Started, Chroma.
Checked
2026-11-16; read Chroma Getting Started; no command was run.
Started from a post by @Chroma, packaged by the editor. Original post