Find answers from the community

Updated 3 months ago

Hi all I have a default storage I want

Hi all, I have a default storage. I want to delete some nodes so that they cannot be queried in subsequent queries. I tried the following code, but it doesn't work:

Plain Text
from llama_index import (
    StorageContext, 
    load_index_from_storage, 
)

path = r"C:\Users\..."
storage_context = StorageContext.from_defaults(persist_dir=path)
index = load_index_from_storage(storage_context, use_async=True)

index.delete_ref_doc( hash_id, delete_from_docstore=True)
myquery = index.as_query_engine())
response = myquery.query(question)

What step am I missing?
W
R
2 comments
I successfully solved this problem. I can’t thank you enough.
Add a reply
Sign up and join the conversation on Discord