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]: Support Apache Solr just similar to Apache Elastic #1

Open Raghavan1988 opened 1 year ago

Raghavan1988 commented 1 year ago

Feature Description

I would like to add support to Apache Solr similar to that of elastic

Reason

No response

Value of Feature

No response

Raghavan1988 commented 1 year ago

@torvalds-dev

torvalds-dev commented 1 year ago

torvalds.dev is analyzing the ticket

torvalds-dev commented 1 year ago

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.