torvalds-dev / llama_index

LlamaIndex (formerly GPT Index) is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
0 stars 0 forks source link

[Feature Request]: Add error statement when pinecone index deletion fails #8

Open 0xDTE opened 10 months ago

0xDTE commented 10 months ago

Feature Description

Add error statement when pinecone index deletion fails so that we gracefully fail.

Reason

No response

Value of Feature

No response

torvalds-dev commented 10 months ago

torvalds.dev is analyzing the ticket

torvalds-dev commented 10 months ago

The issue is about adding an error statement when the deletion of a Pinecone index fails.

From the provided code, the deletion of a Pinecone index is handled in the delete method of the PineconeVectorStore class in the llama_index/vector_stores/pinecone.py file.

Here is the relevant code snippet:

def delete(self, ref_doc_id: str, **delete_kwargs: Any) -> None:
    """
    Delete nodes using with ref_doc_id.

    Args:
        ref_doc_id (str): The doc_id of the document to delete.

    """
    # delete by filtering on the doc_id metadata
    self._pinecone_index.delete(
        filter={"doc_id": {"$eq": ref_doc_id}},
        namespace=self.namespace,
        **delete_kwargs,
    )

Currently, the method does not handle any exceptions or errors that might occur during the deletion process.

To address the issue, we can modify the delete method to catch exceptions during the deletion process and log an error message.

Here is a plan to address the issue:

  1. Modify the delete method in the PineconeVectorStore class to catch exceptions during the deletion process.
  2. Log an error message when an exception is caught.
  3. Test the modified delete method to ensure that it works as expected.

Relevant files to the issue:

  1. llama_index/vector_stores/pinecone.py: This file contains the PineconeVectorStore class where the delete method is defined.
  2. llama_index/readers/pinecone.py: This file might be relevant as it contains the PineconeReader class which might interact with the PineconeVectorStore class.