RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Vector Stores and Embeddings
  6. /Ch. 4
Vector Stores and Embeddings

04. ChromaDB Collections

Chapter 4 of 18 · 20 min
KEY INSIGHT

A collection is a container for related documents—think of it as a table in SQL, but for vectors. Collections hold documents, their embeddings, and metadata. Each collection has a name and a specific embedding function. All documents in a collection use the same embedding model. ```python import chromadb from chromadb.config import Settings client = chromadb.PersistentClient(path="./chroma_db") # Create a collection collection = client.create_collection( name="articles", metadata={"description": "Technical articles about programming"} ) print(f"Collection ID: {collection.id}") print(f"Collection name: {collection.name}") ``` If a collection with that name already exists, `create_collection` raises an error. Use `get_or_create_collection` instead: ```python # Safe: gets existing or creates new collection = client.get_or_create_collection( name="articles", metadata={"description": "Technical articles about programming"} ) ``` Listing and inspecting collections: ```python # List all collections all_collections = client.list_collections() for col in all_collections: print(f"Name: {col.name}, ID: {col.id}, Count: {col.count()}") ``` Output: ``` Name: articles, ID: 1a2b3c4d..., Count: 0 Name: support_tickets, ID: 5e6f7g8h..., Count: 1523 ``` Deleting a collection is permanent and immediate: ```python client.delete_collection(name="articles") ```

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

EXERCISE

Create three collections with different names. List them, verify they exist, then delete two of them. Confirm only one remains.

← Chapter 3
ChromaDB Setup
Chapter 5 →
Adding Documents