A collection is a Chroma container for documents, embeddings, metadata, and identifiers. It gives a retrieval application a named place to ingest content and search its meaning rather than resending the full source with every question. section 6.2.5
A practical collection workflow is:
- Create a collection from a Chroma client, choosing an in-memory client for temporary work or a persistent/client-server setup when data must survive the session. section 6.2.5
- Split source content into documents or chunks, then add the text with metadata such as its source and an associated identifier. section 6.2.5 section 8.3.4
- Let Chroma generate embeddings from supplied text by default, or provide an embedding function when using the LangChain integration. section 6.2.5 section 8.3.4
- Query the collection with natural language and inspect returned documents, identifiers, metadata, and distances; increase the requested result count when broader context is needed. section 6.2.5
One collection, one semantic search
A tourism collection can store three Paestum chunks, each with a Britannica source URL and an identifier. Querying “How many Doric temples are in Paestum” returns the closest chunk containing the answer, together with its metadata and distance. section 6.2.5
Listing 6.1 Creating and populating a ChromaDB collection
tourism_collection.add(
documents=[
"Paestum, Greek Poseidonia, …[shortened] … Greek temples.",
"Poseidonia was probably …[shortened] … in the 18th century.",
"The ancient Greek part of …[shortened] … from the site."
],
metadatas=[
{"source": "https://www.britannica.com/place/Paestum"},
{"source": "https://www.britannica.com/place/Paestum"},
{"source": "https://www.britannica.com/place/Paestum"}
],
ids=["paestum-br-01", "paestum-br-02", "paestum-br-03"]
)
Inspect the complete add operation, including documents, source metadata, and stable identifiers. section 6.2.5
client = chromadb.PersistentClient(path="./chroma_db")
collection = client.create_collection("my_persistent_collection")
Compare an in-memory collection with a collection backed by a persistent Chroma path. section 6.2.5















