Open Raghavan1988 opened 1 year ago
@torvalds-dev
torvalds.dev is analyzing the ticket
The issue "[Feature Request]: Add error statement when pinecone index deleting does not work" seems to be about adding an error message when the deletion of a Pinecone index fails.
From the code provided, 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,
)
The delete
method deletes nodes from the Pinecone index by filtering on the doc_id
metadata. However, it does not currently handle any errors or exceptions that might occur during the deletion process.
To address the issue, you could modify the delete
method to catch exceptions during the deletion process and raise a custom error message. This would involve wrapping the deletion code in a try-except block and raising an error with a custom message in the except block.
Here is a rough example of how you could modify the delete
method:
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.
"""
try:
# delete by filtering on the doc_id metadata
self._pinecone_index.delete(
filter={"doc_id": {"$eq": ref_doc_id}},
namespace=self.namespace,
**delete_kwargs,
)
except Exception as e:
raise ValueError(f"Failed to delete Pinecone index: {e}")
This modification would raise a ValueError
with a custom message if an exception occurs during the deletion process. The message includes the original exception message for more context about the error.
Please note that this is a rough example and the actual implementation might need to be adjusted based on the specific requirements and context of your project.
Feature Description
I would like to add support to Apache Solr similar to that of elastic
Reason
No response
Value of Feature
No response