Find answers from the community

Updated last year

Hey guys I m a bit confused as to how

Hey guys, I'm a bit confused as to how VectorStoreIndex.from_documents work. I am using chromadb to have my code the way I do it is :
1- I upload my document,
2- split it into chunks
3- load it in the vector store using this code
Plain Text
def create_index_from_documents_background(docs, document, storage_context, service_context):
    
    index = VectorStoreIndex.from_documents(docs, storage_context=storage_context, service_context=service_context)
    print(index)
    index.set_index_id(str(document.id))

4- try to retrieve it later using a unified id. Issue is, it returns an empty list. Do I need to commit the changes someone to chromadb or something ?

I've attempted to visualize the VectorStoreIndex in Chroma and that's not possible apparently. Any guidance on how to manage this more efficiently / get me to update the doc_id to be linked to the right document
L
o
3 comments
You can follow the guide here for saving/loading chroma

The key is the VectorStoreIndex.from_vector_store(vector_store, service_context=service_context) method when "loading"

https://docs.llamaindex.ai/en/stable/examples/vector_stores/ChromaIndexDemo.html#basic-example-including-saving-to-disk
Wait is there no way to set up the doc_id directly when inserting to the vector store ?
Looks like I’ve got to edit it first and then I can query to it
Add a reply
Sign up and join the conversation on Discord