Problem
The current EmbeddingsAdapter interface produces generic embeddings that don't capture medical terminology in Spanish. OrionHealth needs embeddings that understand:
- Spanish medical terms (cardiología, nefropatía, etc.)
- Medical abbreviations (TA, FC, SpO2, etc.)
- Domain-specific symptom descriptions
Proposed Solution
Create a MedicalEmbeddingsAdapter that wraps the fallback chain (TFLite → ONNX → Gemini) and:
- Uses a medical domain fine-tuned embedding model OR
- Applies post-processing to enhance medical embeddings
- Supports both English and Spanish medical text
Implementation Plan
- Create lib/src/embeddings/medical_embeddings_adapter.dart
- Extend EmbeddingsAdapter interface with medicalNormalized() method
- Add medical-specific tokenizer that handles abbreviations
- Add integration with existing FallbackEmbeddingsAdapter chain
- Export from isar_agent_memory.dart
Reference
OrionHealth consumer: orionhealth/lib/features/local_agent/infrastructure/services/isar_vector_store_service.dart already uses MemoryGraph for RAG. This adapter will improve retrieval quality for medical queries.
See: spec/technical/on-device-ai.md for existing embedding backend docs in cerebro-flutter.
Problem
The current EmbeddingsAdapter interface produces generic embeddings that don't capture medical terminology in Spanish. OrionHealth needs embeddings that understand:
Proposed Solution
Create a MedicalEmbeddingsAdapter that wraps the fallback chain (TFLite → ONNX → Gemini) and:
Implementation Plan
Reference
OrionHealth consumer: orionhealth/lib/features/local_agent/infrastructure/services/isar_vector_store_service.dart already uses MemoryGraph for RAG. This adapter will improve retrieval quality for medical queries.
See: spec/technical/on-device-ai.md for existing embedding backend docs in cerebro-flutter.