index.delete_ref_doc("doc_id_0", delete_from_docstore=True)
if st.session_state.messages[-1]["role"] != "assistant": with st.chat_message("assistant"): with st.spinner("Thinking..."): base_retriever = index.as_retriever(similarity_top_k=3) llm = OpenAI(model="gpt-3.5-turbo") service_context = ServiceContext.from_defaults(llm=llm) query_engine_base = RetrieverQueryEngine.from_args(base_retriever, service_context=service_context,qa_prompt=qa_prompt) response = query_engine_base.query(prompt) st.write(response.response) if "sorry" in response.response or "not mentioned in" in response.response or "couldn't find in context" in response.response or "does not provide" in response.response: for i in range(len(response.source_nodes)): print(str(response.source_nodes[i].id_)) index.delete(response.source_nodes[i].id_)
index=index.delete(node_id)
it says AttributeError: 'NoneType' object has no attribute 'delete'