_delete() — langchain Function Reference
Architecture documentation for the _delete() function in api.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e0d9b7ca_ea1c_b50e_ee8b_5e232dcff3ba["_delete()"] 203188c0_72d6_6932_bc21_edf25c4c00ef["api.py"] e0d9b7ca_ea1c_b50e_ee8b_5e232dcff3ba -->|defined in| 203188c0_72d6_6932_bc21_edf25c4c00ef 5721a97d_0581_0694_e3e6_0ae44f2b3fb0["index()"] 5721a97d_0581_0694_e3e6_0ae44f2b3fb0 -->|calls| e0d9b7ca_ea1c_b50e_ee8b_5e232dcff3ba style e0d9b7ca_ea1c_b50e_ee8b_5e232dcff3ba fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/indexing/api.py lines 241–271
def _delete(
vector_store: VectorStore | DocumentIndex,
ids: list[str],
) -> None:
"""Delete documents from a vector store or document index by their IDs.
Args:
vector_store: The vector store or document index to delete from.
ids: List of document IDs to delete.
Raises:
IndexingException: If the delete operation fails.
TypeError: If the `vector_store` is neither a `VectorStore` nor a
`DocumentIndex`.
"""
if isinstance(vector_store, VectorStore):
delete_ok = vector_store.delete(ids)
if delete_ok is not None and delete_ok is False:
msg = "The delete operation to VectorStore failed."
raise IndexingException(msg)
elif isinstance(vector_store, DocumentIndex):
delete_response = vector_store.delete(ids)
if "num_failed" in delete_response and delete_response["num_failed"] > 0:
msg = "The delete operation to DocumentIndex failed."
raise IndexingException(msg)
else:
msg = (
f"Vectorstore should be either a VectorStore or a DocumentIndex. "
f"Got {type(vector_store)}."
)
raise TypeError(msg)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _delete() do?
_delete() is a function in the langchain codebase, defined in libs/core/langchain_core/indexing/api.py.
Where is _delete() defined?
_delete() is defined in libs/core/langchain_core/indexing/api.py at line 241.
What calls _delete()?
_delete() is called by 1 function(s): index.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free