Commit 313e586
committed
feat(rag): wire HyDE retrieval into RetrievalAugmentor, multimodal search, and memory recall
HyDE (Hypothetical Document Embedding) was fully implemented as a standalone
HydeRetriever class but never called in any actual retrieval pipeline.
Wire it into three pipelines:
1. RetrievalAugmentor.retrieveContext() — main RAG pipeline
- Add setHydeLlmCaller() for LLM registration
- When options.hyde.enabled, generate hypothesis and embed it instead
of the raw query
- Support pre-supplied hypotheses (skip LLM call)
- Graceful fallback to direct embedding on any failure
- HyDE diagnostics in RagRetrievalDiagnostics
- Audit trail integration (operation type 'hyde')
2. MultimodalIndexer.search() — cross-modal search
- Add setHydeRetriever() to attach a HyDE retriever
- When opts.hyde.enabled, delegate to HydeRetriever.retrieve()
with adaptive thresholding
- Support pre-supplied hypotheses and modality filtering
3. CognitiveMemoryManager.retrieve() — memory recall
- Add setHydeRetriever() / getHydeRetriever()
- When options.hyde is true, generate a hypothetical memory trace
and search using that instead of the raw query
- Non-critical: failures fall back silently to raw query
Also:
- Add 'hyde' to RAGOperationEntry.operationType union
- Add hydeDetails to RAGOperationEntry for audit transparency
- Add setHydeDetails() to RAGOperationHandle
- Add hyde diagnostics to RagRetrievalDiagnostics
- Add hyde option to CognitiveRetrievalOptions
- Add hyde option to MultimodalSearchOptions
- 10 new tests covering all HyDE integration paths1 parent 7b80ed6 commit 313e586
10 files changed
Lines changed: 740 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
154 | 166 | | |
155 | 167 | | |
156 | 168 | | |
| |||
191 | 203 | | |
192 | 204 | | |
193 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
194 | 216 | | |
195 | 217 | | |
196 | 218 | | |
| |||
405 | 427 | | |
406 | 428 | | |
407 | 429 | | |
408 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
409 | 450 | | |
410 | 451 | | |
411 | 452 | | |
| |||
805 | 846 | | |
806 | 847 | | |
807 | 848 | | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
808 | 878 | | |
809 | 879 | | |
810 | 880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
191 | 206 | | |
192 | 207 | | |
193 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
137 | 152 | | |
138 | 153 | | |
139 | 154 | | |
| |||
0 commit comments