ed
6399dcc4ed
refactor(rag_engine,ai_client): rag_engine.search returns List[RAGChunk] directly
...
Phase 5: rag_engine.search() return type (FR4 row 7)
Before: def search(...) -> List[Dict[str, Any]] at src/rag_engine.py:367
After: def search(...) -> List["RAGChunk"]
Delta: -1 wrong type annotation (List[Dict] -> List[RAGChunk])
RAGChunk dataclass extended with `id: str = ""` field to preserve the
chroma wire-format identifier. The search() function now constructs
RAGChunk instances directly from chromadb query results, normalizing
the wire format (metadata.path -> RAGChunk.path; distance -> 1.0 - score)
at the boundary.
Consumer updates:
- src/ai_client.py:3259-3266: chunk["metadata"]["path"] -> chunk.path;
chunk["document"] -> chunk.document (direct attribute access)
- src/app_controller.py:3506: docstring updated from Result[List[Dict]]
to Result[List[RAGChunk]] (no code change; pass-through)
Test updates:
- tests/test_rag_engine.py:61: results[0]["id"] -> results[0].id
(now uses dataclass attribute access)
Verification:
- audit_weak_types --strict: OK (107 <= 112 baseline)
- py_check_syntax: OK on rag_engine.py, ai_client.py, test_rag_engine.py
- 21 RAG tests pass (test_rag_engine, test_rag_chunk,
test_rag_engine_ready_status_bug, test_rag_integration,
test_context_composition_decoupled, test_tiered_aggregation)
2026-06-26 04:54:02 -04:00
ed
ee3c90b865
refactor(rag_engine): Result API + NilRAGState (_init_vector_store, _validate_collection_dim, _get_state)
2026-06-12 20:14:40 -04:00
ed
40f905d14b
test(rag): update dim-mismatch test to assert rmtree behavior
...
The fix in 644d88ab changed the recovery path from client.delete_collection
to shutil.rmtree (chromadb 1.5.x delete_collection is broken on corrupted
state). The test still asserted the old behavior.
2026-06-09 14:50:55 -04:00
r00tz
9e4fac496d
made local rag needs optional (prevents having to have torch / sentence-transformers if you never use local embedding)
2026-06-06 13:21:43 -04:00
ed
16412ad5f9
fix(rag): detect ChromaDB dim mismatch and recreate collection on provider switch
2026-06-06 11:26:47 -04:00
ed
45104af1ee
fix(rag): Final RAG stability and status fixes
...
- Corrected GeminiEmbeddingProvider model name to gemini-embedding-001.
- Prevented _fetch_models from overwriting active i_status (sending/done/error).
- Updated est_rag_engine.py to correctly patch the lazy-loaded chromadb getter.
- Adjusted RAG simulation tests to account for the new initializing... status and automatic initial indexing.
- Fixed typo in est_z_negative_flows.py.
2026-05-14 23:38:23 -04:00
ed
33e532a491
test(rag): Fix test_rag_engine.py mock assertion
...
Updated the test to correctly mock _get_sentence_transformers instead of SentenceTransformer to account for lazy loading imports.
2026-05-14 20:24:23 -04:00
ed
e80cd6bd3f
feat(rag): Implement RAG engine, configuration schema, and vector store integration
2026-05-04 05:38:23 -04:00