Skip embedding validation on document deletion
This commit is contained in:
parent
cb3e30b66a
commit
3034280c78
4 changed files with 29 additions and 1 deletions
|
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
- `hotpotqa` evaluation dataset.
|
- `hotpotqa` evaluation dataset.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Document deletion no longer raises `ConfigMismatchError` on embedding config drift.
|
||||||
|
|
||||||
## [0.67.0] - 2026-07-16
|
## [0.67.0] - 2026-07-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -492,6 +492,7 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
db_path=self.db_path,
|
db_path=self.db_path,
|
||||||
config=self.config,
|
config=self.config,
|
||||||
read_only=self.read_only,
|
read_only=self.read_only,
|
||||||
|
skip_validation=True,
|
||||||
) as self.client:
|
) as self.client:
|
||||||
deleted = await self.client.delete_document(doc_id)
|
deleted = await self.client.delete_document(doc_id)
|
||||||
if deleted:
|
if deleted:
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ def create_mcp_server(
|
||||||
async def delete_document(document_id: str) -> bool:
|
async def delete_document(document_id: str) -> bool:
|
||||||
"""Delete a document by its ID."""
|
"""Delete a document by its ID."""
|
||||||
try:
|
try:
|
||||||
async with HaikuRAG(db_path, config=config) as rag:
|
async with HaikuRAG(
|
||||||
|
db_path, config=config, skip_validation=True
|
||||||
|
) as rag:
|
||||||
return await rag.delete_document(document_id)
|
return await rag.delete_document(document_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
|
from haiku.rag.app import HaikuRAGApp
|
||||||
from haiku.rag.client import HaikuRAG
|
from haiku.rag.client import HaikuRAG
|
||||||
from haiku.rag.client.documents import parent_uri_filter
|
from haiku.rag.client.documents import parent_uri_filter
|
||||||
|
from haiku.rag.config.models import AppConfig
|
||||||
from haiku.rag.store.models.document import Document
|
from haiku.rag.store.models.document import Document
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -126,6 +128,25 @@ async def test_delete_handles_self_referential_parent(temp_db_path):
|
||||||
assert await client.get_document_by_id(doc.id) is None
|
assert await client.get_document_by_id(doc.id) is None
|
||||||
|
|
||||||
|
|
||||||
|
async def test_delete_succeeds_with_embedding_dim_mismatch(temp_db_path):
|
||||||
|
"""Deletion touches no embeddings, so a vector_dim mismatch must not block it."""
|
||||||
|
async with HaikuRAG(temp_db_path, create=True) as client:
|
||||||
|
doc = await client.document_repository.create(
|
||||||
|
Document(content="body", uri="file:///doc.pdf", metadata={})
|
||||||
|
)
|
||||||
|
|
||||||
|
mismatched = AppConfig()
|
||||||
|
mismatched.embeddings.model.vector_dim = 9999
|
||||||
|
|
||||||
|
app = HaikuRAGApp(db_path=temp_db_path, config=mismatched)
|
||||||
|
await app.delete_document(doc.id)
|
||||||
|
|
||||||
|
async with HaikuRAG(
|
||||||
|
temp_db_path, config=mismatched, skip_validation=True
|
||||||
|
) as client:
|
||||||
|
assert await client.get_document_by_id(doc.id) is None
|
||||||
|
|
||||||
|
|
||||||
def test_processing_config_extract_pdf_attachments_default_true():
|
def test_processing_config_extract_pdf_attachments_default_true():
|
||||||
from haiku.rag.config.models import ProcessingConfig
|
from haiku.rag.config.models import ProcessingConfig
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue