glam/backend/rag
kempersc 99dc608826 Refactor RAG to template-based SPARQL generation
Major architectural changes based on Formica et al. (2023) research:
- Add TemplateClassifier for deterministic SPARQL template matching
- Add SlotExtractor with synonym resolution for slot values
- Add TemplateInstantiator using Jinja2 for query rendering
- Refactor dspy_heritage_rag.py to use template system
- Update main.py with streamlined pipeline
- Fix semantic_router.py ordering issues
- Add comprehensive metrics tracking

Template-based approach achieves 65% precision vs 10% LLM-only
per Formica et al. research on SPARQL generation.
2026-01-07 22:04:43 +01:00
..
benchmark_results enrich custodian profiles 2026-01-02 02:10:18 +01:00
optimized_models fix(rag): correct SPARQL ontology prefixes for LinkML schema 2025-12-22 21:31:08 +01:00
specificity Enhance specificity scoring system integration with existing infrastructure 2026-01-05 17:37:49 +01:00
__init__.py Fix LinkML URI conflicts and generate RDF outputs 2026-01-07 12:32:59 +01:00
atomic_decomposer.py enrich custodians 2025-12-11 22:32:09 +01:00
benchmark_lm_optimization.py remove a,bihguous web-claims 2025-12-21 00:01:54 +01:00
benchmark_optimization.py remove a,bihguous web-claims 2025-12-21 00:01:54 +01:00
benchmark_optimization_v2.py enrich entries 2025-12-21 22:12:34 +01:00
benchmark_performance.py enrich custodian profiles 2026-01-02 02:10:18 +01:00
benchmark_prompt_caching.py enrich entries 2025-12-23 13:27:35 +01:00
cache_config.py enrich custodians 2025-12-11 22:32:09 +01:00
cost_tracker.py enrich person custodian 2025-12-14 17:09:55 +01:00
dspy_heritage_rag.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
event_retriever.py Fix LinkML URI conflicts and generate RDF outputs 2026-01-07 12:32:59 +01:00
gepa_training_extended.py enrich custodians 2025-12-11 22:32:09 +01:00
LM_OPTIMIZATION_FINDINGS.md enrich entries 2025-12-21 22:12:34 +01:00
main.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
metrics.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
ontology_mapping.py feat(rag): Add hybrid language detection and enhanced ontology mapping 2025-12-14 15:55:18 +01:00
optimization_log.txt enrich custodians 2025-12-11 22:32:09 +01:00
optimize_templates.py enrich HC profiles 2026-01-02 02:11:04 +01:00
optimized_heritage_router.json enrich person custodian 2025-12-14 17:09:55 +01:00
reply_types.py enrich CH entries with mission statements 2026-01-04 13:12:32 +01:00
requirements.txt add sparql validator and RAG injector 2025-12-30 03:43:31 +01:00
run_bootstrap_optimization.py enrich custodians 2025-12-11 22:32:09 +01:00
run_gepa_optimization.py enrich custodians 2025-12-11 22:32:09 +01:00
run_mipro_optimization.py remove a,bihguous web-claims 2025-12-21 00:01:54 +01:00
schema_loader.py Enhance specificity scoring system integration with existing infrastructure 2026-01-05 17:37:49 +01:00
semantic_cache.py enrich entries 2025-12-23 13:27:35 +01:00
semantic_router.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
session_manager.py enrich HC profiles 2026-01-02 02:11:04 +01:00
template_sparql.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
temporal_intent.py Fix LinkML URI conflicts and generate RDF outputs 2026-01-07 12:32:59 +01:00
temporal_resolver.py Fix LinkML URI conflicts and generate RDF outputs 2026-01-07 12:32:59 +01:00
test_dspy_rag.py enrich person custodian 2025-12-14 17:09:55 +01:00
test_live_rag.py fix(rag): correct SPARQL ontology prefixes for LinkML schema 2025-12-22 21:31:08 +01:00
test_rate_limit_handling.py enrich entries 2025-12-23 13:27:35 +01:00
test_semantic_routing.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
test_template_sota.py Refactor RAG to template-based SPARQL generation 2026-01-07 22:04:43 +01:00
test_temporal_intent.py Fix LinkML URI conflicts and generate RDF outputs 2026-01-07 12:32:59 +01:00