docs(examples): add heterogeneous financial document RAG evaluation example with threshold_overrides#2790
Draft
Ruthwik-Data wants to merge 8 commits into
Draft
Conversation
…xample with threshold_overrides This script evaluates a financial RAG pipeline using document-type-specific thresholds for various document types, including balance sheets and earnings calls. It implements metrics for faithfulness, precision, and recall, and demonstrates how to handle different thresholds based on document type.
|
@Ruthwik-Data is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
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
Adds
examples/rag_evaluation/heterogeneous_document_eval.py— a runnable example demonstrating how to evaluate a financial RAG pipeline that retrieves chunks from mixed document types (balance sheets, 10-K narratives, earnings call transcripts) using document-type-specific thresholds.Relates to #2775 and complements PR #2785 (
threshold_overridesimplementation).Why this example is needed
Issue #2775 raised a real gap: the existing
examples/rag_evaluation/directory has no example covering heterogeneous corpora. A single global threshold causes systematic false failures or false passes when evaluating mixed document types:This example shows users exactly how to use
additional_metadata["document_type"]today (readable pattern), with commented-outthreshold_overrideslines that will activate once PR #2785 is merged.What this PR adds
Sections:
THRESHOLD_OVERRIDES— dict mapping document types to thresholds (balance_sheet: 0.95, annual_report: 0.80, earnings_call: 0.70)build_test_cases()— threeLLMTestCaseinstances withdocument_typemetadata for each document typebuild_metrics()—FaithfulnessMetric,ContextualPrecisionMetric,ContextualRecallMetricwith commented threshold_overrides lines (forward-compatible with PR feat(metrics): add document-type threshold overrides for heterogeneous RAG evaluation #2785)run_heterogeneous_eval()— runsevaluate()and prints per-document-type scores with expected thresholdsDesign notes
# Uncomment post-PR #2785commentsOPENAI_API_KEY— no additional dependenciesexamples/rag_evaluation/Type of change