Chroma Vector Store
Creating a Chroma Index
import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
import chromadb
chroma_client = chromadb.Client()
chroma_collection = chroma_client.create_collection("quickstart")
a#### Load documents, build the GPTVectorStoreIndex with ChromaVectorStore
from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader
from llama_index.vector_stores import ChromaVectorStore
from IPython.display import Markdown, display
# load documents
documents = SimpleDirectoryReader('../paul_graham_essay/data').load_data()
from llama_index.storage.storage_context import StorageContext
vector_store = ChromaVectorStore(chroma_collection=chroma_collection)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = GPTVectorStoreIndex.from_documents(documents, storage_context=storage_context)
Query Index
# set Logging to DEBUG for more detailed outputs
query_engine = index.as_query_engine(
chroma_collection=chroma_collection
)
response = query_engine.query("What did the author do growing up?")
display(Markdown(f"<b>{response}</b>"))