Find answers from the community

Updated 4 months ago

Refreshing the Index Results in a Python

At a glance

A community member is encountering a TypeError when trying to refresh the index using the LlamaIndex library. They are following the instructions provided in the LlamaIndex documentation, but the refresh_ref_docs() method is throwing an error related to the delete_from_docstore parameter.

In the comments, another community member asks for clarification on how the documents and index are being defined, and the original poster provides that information. The community members then discuss that the update_kwargs parameter may not be necessary, and that the delete_from_docstore behavior may happen automatically without the need to specify it.

There is no explicitly marked answer in the comments, but the community members seem to have reached the conclusion that the delete_from_docstore parameter may not need to be specified, and that this could be the way to achieve a proper upsert operation.

Useful resources
Refreshing the Index Results in a Python Error

I am adhering to the instructions provided here: https://docs.llamaindex.ai/en/latest/module_guides/indexing/document_management.html#refresh

Plain Text
index = VectorStoreIndex.from_vector_store(vector_store=vector_store, service_context=service_context)
refreshed_docs = index.refresh_ref_docs(
    documents,
    update_kwargs={"delete_kwargs": {
        "delete_from_docstore": True
    }}
)


Error: ERROR - Unexpected err=TypeError("delete_ref_doc() got multiple values for keyword argument 'delete_from_docstore'"), type(err)=<class 'TypeError'>

I am using the latest version of LlamaIndex. Can anyone please help?
m
S
L
7 comments
can i see where you are defining your documents and index
sure

Plain Text
loader = JsonDataReader()
        documents = loader.load_data(source_data)


That's documents.

Plain Text
index = VectorStoreIndex.from_vector_store(vector_store=vector_store, service_context=service_context)


I am using Qdrant as the vector store
No need to pass the update kwargs it seems πŸ€”
@Logan M got it, thanks! So looks like it'll do a delete_from_docstore even without the kwargs, right?
Seems like it!
That would be the only way to do a proper upsert
Add a reply
Sign up and join the conversation on Discord