index.storage_context.persist()
is not storing the vector_store and creating thevector_store.json
file
When I try to load from disk and run sc2 = StorageContext.from_defaults(persist_dir='./storage')
, i get the following error:
No existing llama_index.vector_stores.simple found at ./storage/vector_store.json, skipping load.
I only have 1 document in my documents directory... Your example had 2. I wonder if that has soemthing to do with the issue?
![image](https://private-user-images.githubusercontent.com/60331570/258454007-96812178-e3f8-49d6-8bd9-a2d609b69629.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg2MzIzMzIsIm5iZiI6MTcxODYzMjAzMiwicGF0aCI6Ii82MDMzMTU3MC8yNTg0NTQwMDctOTY4MTIxNzgtZTNmOC00OWQ2LThiZDktYTJkNjA5YjY5NjI5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE3VDEzNDcxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcyNTFiMmE3MGVhMDg5YmMwMzM0YjU0ODgxMDc4NWU5YWY4YWQ4NWI5YTA1MWZlMjQwMTM0ODU5NWUyYmFkMTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rKSjNmjjVc_IB-I8TonzvowqA3GJwH1BOGp6-Xv0-RE)
Full Code:
with open('KPMGOutlook/kpmgoutlook.text', 'w') as file: file.write(kpmg_text)
documents = SimpleDirectoryReader('KPMGOutlook').load_data()
vector_store = ChromaVectorStore(chroma_collection)
storage_context = StorageContext.from_defaults(vector_store=vector_store,persist_dir='storage')
index = GPTVectorStoreIndex.from_documents(documents, storage_context=storage_context)
index.storage_context.persist()
query_engine = index.as_query_engine()
#Querying document. this works fine
r = query_engine.query("Which economy has the most positive outlook?")
print(r)
#This line gives me the error
sc2 = StorageContext.from_defaults(persist_dir='./storage')