Improve evaluation sample test recordings and LLM validation#45506
Merged
howieleung merged 1 commit intomainfrom Mar 5, 2026
Merged
Improve evaluation sample test recordings and LLM validation#45506howieleung merged 1 commit intomainfrom
howieleung merged 1 commit intomainfrom
Conversation
7af80fe to
9b7db14
Compare
9b7db14 to
e47ea77
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of evaluation sample test recordings and reduces false-positive LLM validation failures. It replaces unsafe/provocative test data in a sample with benign content, rewrites the LLM validation instructions to better handle evaluation-specific output patterns, and introduces a validation_text_preprocessor callback parameter to allow domain-specific text transformations before LLM validation.
Changes:
- Rewrote the
evaluations_instructionsprompt and added_annotate_eval_metric_fields()to reduce LLM false positives caused by JSON metric counters like"failed": 0being mistaken for actual errors - Added
validation_text_preprocessor: Optional[Callable[[str], str]]parameter toBaseSampleExecutor,SyncSampleExecutor, andAsyncSampleExecutor - Replaced violent/provocative inline test data with benign health and writing content; added 2 samples to the skip list; updated asset tag for re-recorded tests
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test_samples_evaluations.py |
Rewrote LLM validation prompt, added _annotate_eval_metric_fields preprocessor, added 2 entries to skip list, passed preprocessor to all 3 test executors |
sample_executor.py |
Added validation_text_preprocessor optional parameter to all executor classes; applied it in _build_validation_text; minor refactoring of _capture_print |
sample_evaluations_builtin_with_inline_data.py |
Replaced violent inline test data with safe health/writing content |
assets.json |
Updated recording tag to python/ai/azure-ai-projects_e4ec8a475a for re-recorded tests |
You can also share your feedback on Copilot code review. Take the survey.
sdk/ai/azure-ai-projects/tests/samples/test_samples_evaluations.py
Outdated
Show resolved
Hide resolved
howieleung
reviewed
Mar 4, 2026
sdk/ai/azure-ai-projects/tests/samples/test_samples_evaluations.py
Outdated
Show resolved
Hide resolved
7f7a807 to
cde836e
Compare
- Filter HTTP debug noise from LLM validation text to reduce false positives - Add metric counter annotations for JSON, pprint, and Python repr formats - Replace violent inline test data with benign content - Add missing samples to skip list (dataset_id, continuous_evaluation_rule) - Re-record all 23 evaluation sample tests with improved preprocessing - Add allowed_llm_validation_failures for red team test - Change validation_text_preprocessor to accept list[str] for entry-level filtering Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cde836e to
1a20f62
Compare
howieleung
approved these changes
Mar 5, 2026
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.
Changes (4 files)
1. Replace unsafe inline data in sample (
sample_evaluations_builtin_with_inline_data.py)2. Improve LLM validation prompt (
test_samples_evaluations.py)evaluations_instructionsprompt to reduce false positives:"failed": 0,"error": null) are normal outputFAILED_EXECUTION)_annotate_eval_metric_fields()preprocessor function scoped to evaluation tests onlysample_evaluations_builtin_with_dataset_id.py(requires Blob Storage prerequisite)sample_continuous_evaluation_rule.py(requires manual RBAC assignment)3. Add generic validation text preprocessing support (
sample_executor.py)validation_text_preprocessorcallback parameter (domain-agnostic) to allow test-specific text transformations before LLM validation4. Re-recorded all 24 evaluation sample tests (
assets.json)python/ai/azure-ai-projects_e4ec8a475aAddresses