Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.storage_context.persist() not working as expected #10

Open
emilio-fiallos opened this issue Aug 4, 2023 · 0 comments
Open

index.storage_context.persist() not working as expected #10

emilio-fiallos opened this issue Aug 4, 2023 · 0 comments

Comments

@emilio-fiallos
Copy link

index.storage_context.persist() is not storing the vector_store and creating thevector_store.json file

image

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

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant