Delete ids from the vector store.
Example:
from langchain_redis import RedisVectorStore
from langchain_openai import OpenAIEmbeddings
vector_store = RedisVectorStore(
index_name="langchain-demo",
embedding=OpenAIEmbeddings(),
redis_url="redis://localhost:6379",
)
# Assuming documents with these ids exist in the store
ids_to_delete = ["doc1", "doc2", "doc3"]
result = vector_store.delete(ids=ids_to_delete)
if result:
print("Documents were succesfully deleted")
else:
print("No Documents were deleted")
Note:
ids is None or an empty list, the method returns False.Falsedrop_keys functionality from RedisVL to delete
the keys from Redis.key_prefix specified
in the configuration.Optional list of ids of the documents to delete.
Additional keyword arguments (not used in the current implementation).