Renamed FaissVectorIOAdapter delete_chunk to delete_chunks

It now handles a list of chunk_id's

Signed-off-by: Derek Higgins <derekh@redhat.com>
This commit is contained in:
Derek Higgins 2025-07-25 13:51:37 +01:00
parent 4e9bb9a47e
commit 9b6864b0ed
8 changed files with 20 additions and 18 deletions

View file

@ -289,7 +289,8 @@ class FaissVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtocolPr
return await index.query_chunks(query, params)
async def delete_chunk(self, store_id: str, chunk_id: str) -> None:
async def delete_chunks(self, store_id: str, chunk_ids: list[str]) -> None:
"""Delete a chunk from a faiss index"""
faiss_index = self.cache[store_id].index
await faiss_index.delete_chunk(chunk_id)
for chunk_id in chunk_ids:
await faiss_index.delete_chunk(chunk_id)

View file

@ -550,11 +550,12 @@ class SQLiteVecVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtoc
raise ValueError(f"Vector DB {vector_db_id} not found")
return await index.query_chunks(query, params)
async def delete_chunk(self, store_id: str, chunk_id: str) -> None:
async def delete_chunks(self, store_id: str, chunk_ids: list[str]) -> None:
"""Delete a chunk from a sqlite_vec index."""
index = await self._get_and_cache_vector_db_index(store_id)
if not index:
raise ValueError(f"Vector DB {store_id} not found")
# Use the index's delete_chunk method
await index.index.delete_chunk(chunk_id)
for chunk_id in chunk_ids:
# Use the index's delete_chunk method
await index.index.delete_chunk(chunk_id)