diff --git a/src/evaluations/benchmark.py b/src/evaluations/benchmark.py index 4eb31835..055efda5 100644 --- a/src/evaluations/benchmark.py +++ b/src/evaluations/benchmark.py @@ -61,7 +61,6 @@ async def populate_db(spec: DatasetSpec) -> None: metadata=payload.metadata, ) progress.advance(task) - rag.store.vacuum() def _is_relevant_match(retrieved_uri: str | None, sample: RetrievalSample) -> bool: diff --git a/src/haiku/rag/store/repositories/document.py b/src/haiku/rag/store/repositories/document.py index ffc66a1b..dc31878d 100644 --- a/src/haiku/rag/store/repositories/document.py +++ b/src/haiku/rag/store/repositories/document.py @@ -200,6 +200,8 @@ class DocumentRepository: chunk.order = order await self.chunk_repository.create(chunk) + # Vacuum old versions after successful creation + self.store.vacuum() return created_doc except Exception: # Roll back to the captured versions and re-raise @@ -230,6 +232,8 @@ class DocumentRepository: updated_doc.id, docling_document ) + # Vacuum old versions after successful update + self.store.vacuum() return updated_doc except Exception: # Roll back to the captured versions and re-raise