Private
Public Access
0
0

restore comment

This commit is contained in:
2026-06-12 20:26:48 -04:00
parent 8251d2cb28
commit 6f5b5f91c4
+12
View File
@@ -128,6 +128,18 @@ class RAGEngine:
return Result(data=None, errors=[ErrorInfo(kind=ErrorKind.CONFIG, message=f"Unknown vector store provider: {vs_config.provider}", source="rag._init_vector_store")])
def _validate_collection_dim_result(self) -> Result[None]:
"""
Detect dimension mismatch between an existing collection's vectors and
the current embedding provider's output. When mismatched (e.g. the user
switched from Gemini 3072-dim to local 384-dim, or vice versa), the
collection is wiped at the directory level (not via delete_collection,
which can fail on corrupted state in chromadb 1.5.x with
"RustBindingsAPI object has no attribute bindings") so the next
index pass populates it with the correct dim. Prevents silent
corruption that would later surface as a search error
("Collection expecting embedding with dimension of X, got Y") and
hang live_gui tests.
"""
if self.collection is None or self.collection == "mock" or self.embedding_provider is None:
return Result(data=None)
try: