feat: baseline RAG pipeline with FunSQL grounding, ingestion, and HuggingFace model support#42
Open
ParamThakkar123 wants to merge 11 commits into
Open
feat: baseline RAG pipeline with FunSQL grounding, ingestion, and HuggingFace model support#42ParamThakkar123 wants to merge 11 commits into
ParamThakkar123 wants to merge 11 commits into
Conversation
…gingFace model schema support - Add ingestion.jl: document loading, chunking, RAGTools index building - Add grounding.jl: curated FunSQL prompt template + OMOP/CDM schema corpus - Add pipeline.jl: high-level orchestration (setup index, answer questions) - Update query.jl: template-based generation with grounded FunSQL context - Create docs/grounding/: FunSQL ref, OMOP schema, SQL-to-FunSQL patterns - Add demo/basic_rag_pipeline.jl: end-to-end runnable demo - Fix pre-existing bugs: duplicate load_huggingface_model, Base.convert import conflict - Bump PromptingTools/RAGTools compat range for HuggingFaceSchema support
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
==========================================
+ Coverage 27.27% 31.89% +4.62%
==========================================
Files 4 11 +7
Lines 88 533 +445
==========================================
+ Hits 24 170 +146
- Misses 64 363 +299 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Add src/benchmark.jl: Benchmark module with run_zeroshot() and run_rag() - Add scripts/run_benchmark.jl: runnable script with CLI args - Benchmark evaluates model-generated FunSQL by executing against DuckDB - Tolerant DataFrame comparator for result validation - Loads FunSQLQueries dataset and Synthea DuckDB automatically
…omparison runner - compute_retrieval_stats: tracks chunk counts, unique sources, embedding score distributions - compute_detailed_metrics: accuracy, parse/execution success rates, per-query-group breakdown, error type classification - compute_comparison: side-by-side zero-shot vs RAG with accuracy delta and per-query agreement - run_rag captures full RAGResult (sources, candidate scores) via return_all=true - run_zeroshot updated to track parse_ok/exec_ok separately from final result match - run_comparison convenience function runs both modes and compares - CLI updated with comparison mode and rich metric display - 28 new tests for all metric functions
…to baseline-rag-pipeline
Resolved merge conflicts: - Keep all deps from both sides in Project.toml - Keep all source includes in HealthLLM.jl (embedding.jl removed, build_index_rag moved to utils.jl) - Keep pgvector.jl module, database.jl uses it - Include both benchmark_metrics_test.jl and utils_tests.jl in runtests.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the baseline RAG pipeline for FunSQL.jl workflow support (Deliverable #1 from the GSoC proposal).
New Modules
src/ingestion.jl— Document loading, chunking viaTextChunker, andChunkEmbeddingsIndexbuilding via RAGToolssrc/grounding.jl— Registers:FunSQLQueryGenerationand:FunSQLQueryDirecttemplates with curated system prompts encoding FunSQL syntax, OMOP CDM schema, and response format rulessrc/pipeline.jl— Orchestration layer:setup_grounding_index(),answer_question()(RAG),answer_question_direct()(no-RAG baseline)Grounding Corpus (
docs/grounding/)funsql_reference.md— Complete FunSQL.jl syntax reference with 15 translation patternsomop_cdm_schema.md— 16 OMOP CDM tables with key columns and common query patternssql_to_funsql_patterns.md— 15 SQL→FunSQL translation patterns with before/after examplesEnhancements
src/query.jl— Refactored to use template-based generation, supports both RAG and direct (no-context) modesProject.toml— Bumped PromptingTools/RAGTools compat range to allow HuggingFaceSchemaBug Fixes
load_huggingface_modelmethod fromutils.jlBase.convertimport conflict indatabase.jl/pgvector.jlDemo
demo/basic_rag_pipeline.jl— Runnable end-to-end demo showing index building → RAG query → generated FunSQLAll 5 existing tests pass. Feature complete for the baseline — ingestion, grounding, prompt construction, retrieval, and generation are all wired together in a modular, provider-agnostic pipeline.