Skip to content

ChromaVectorStore

Quick start examples

Below are short, copy-pasteable examples that demonstrate the most common ways to create and use a ChromaVectorStore.

# 1) Temporary/Ephemeral in RAM Chroma
temporary_store = ChromaVectorStore(
        collection_name="ephemeral_collection",
        embedding_function=embedding_function,
)

# 2) Persistent local Chroma
local_store = ChromaVectorStore(
        collection_name="persistent_collection",
        embedding_function=embedding_function,
        path="/var/lib/chroma",  # example filesystem path
)

# 3) Remote HTTP Chroma
store = ChromaVectorStore(
        collection_name="remote_collection",
        embedding_function=embedding_function,
        host="chroma.example.local",
        port=8000,
)

chunks = []
for article in articles_data:
    chunk = Chunk(
        content=article['content'],
        document=article['document'],
        metadata={
            "title": article['title'],
            "author": article['author'],
            "date": article['date']
        }
    )
    chunks.append(chunk)

id_list = store.upsert(chunks)