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

@ -153,7 +153,7 @@ class OpenAIVectorStoreMixin(ABC):
self.openai_vector_stores = await self._load_openai_vector_stores()
@abstractmethod
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 vector store."""
pass
@ -770,9 +770,7 @@ class OpenAIVectorStoreMixin(ABC):
dict_chunks = await self._load_openai_vector_store_file_contents(vector_store_id, file_id)
chunks = [Chunk.model_validate(c) for c in dict_chunks]
for c in chunks:
if c.chunk_id:
await self.delete_chunk(vector_store_id, str(c.chunk_id))
await self.delete_chunks(vector_store_id, [str(c.chunk_id) for c in chunks if c.chunk_id])
store_info = self.openai_vector_stores[vector_store_id].copy()