JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

qwe | JustPaste.app
about 2 months ago10 views
💻Technology

qwe

import chromadb

from llama_index.vector_stores.chroma import (
    ChromaVectorStore
)

from llama_index.core import StorageContext


def get_storage_context(
    collection_name
):

    client = chromadb.PersistentClient(
        path="./chroma_db"
    )

    collection = (
        client.get_or_create_collection(
            collection_name
        )
    )

    vector_store = ChromaVectorStore(
        chroma_collection=collection
    )

    storage_context = (
        StorageContext.from_defaults(
            vector_store=vector_store
        )
    )

    return storage_context
← Back to timeline