-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[evaluation] refactor _evaluate_query parameter to kwargs #42168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[evaluation] refactor _evaluate_query parameter to kwargs #42168
Conversation
…ward compatibility Co-authored-by: slister1001 <103153180+slister1001@users.noreply.github.com>
…efactoring Co-authored-by: slister1001 <103153180+slister1001@users.noreply.github.com>
_evaluate_query
parameter without using private kwargs
Instead of making it public, make it a kwargs |
…plicit parameter Co-authored-by: slister1001 <103153180+slister1001@users.noreply.github.com>
Changed the approach to use kwargs pattern instead of an explicit public parameter. The |
we don't need to maintain backward compatibility since we never released _evaluate_query. also please update the changelog to reflect the updated behavior |
…e changelog Co-authored-by: slister1001 <103153180+slister1001@users.noreply.github.com>
Removed backward compatibility logic for |
...ation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_content_safety/_content_safety.py
Outdated
Show resolved
Hide resolved
...ure-ai-evaluation/azure/ai/evaluation/_evaluators/_protected_material/_protected_material.py
Outdated
Show resolved
Hide resolved
...-evaluation/azure/ai/evaluation/_evaluators/_ungrounded_attributes/_ungrounded_attributes.py
Outdated
Show resolved
Hide resolved
Co-authored-by: slister1001 <103153180+slister1001@users.noreply.github.com>
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the _evaluate_query
parameter from a private parameter (prefixed with underscore) to a public evaluate_query
parameter across all RAI service evaluators, following proper API design principles while maintaining full backward compatibility.
Key changes:
- Converted private
_evaluate_query
parameter to publicevaluate_query
parameter across 11 RAI service evaluators - Updated base class
RaiServiceEvaluatorBase
to handle the new parameter through kwargs with backward compatibility - Modified
ContentSafetyEvaluator
to properly extract and pass theevaluate_query
parameter to its constituent evaluators
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
_base_rai_svc_eval.py | Updated base class to extract evaluate_query from kwargs instead of explicit parameter |
_content_safety.py | Updated docstring and refactored to extract evaluate_query from kwargs for sub-evaluators |
_violence.py, _sexual.py, _self_harm.py, _hate_unfairness.py | Removed explicit _evaluate_query parameter, now using kwargs |
_service_groundedness.py | Removed _evaluate_query parameter from constructor |
_protected_material.py, _code_vulnerability.py, _ungrounded_attributes.py | Added default value logic for evaluate_query in kwargs |
xpia.py, _eci.py | Simplified constructor to use kwargs instead of explicit parameter |
CHANGELOG.md | Updated to reflect the new public parameter addition |
Problem
The
_evaluate_query
parameter in RAI service evaluators was implemented as a private parameter (prefixed with underscore), making it non-standard for public API usage. Users had to rely on private kwargs to access this functionality, which is not good API design practice.Solution
Refactored the
_evaluate_query
parameter to a publicevaluate_query
parameter across all RAI service evaluators while maintaining full backward compatibility.Changes Made
Public API Change
_evaluate_query=True
(private parameter)evaluate_query=True
(public parameter)Affected Components
RaiServiceEvaluatorBase
with public parameter and backward compatibility logicContentSafetyEvaluator
ViolenceEvaluator
SexualEvaluator
SelfHarmEvaluator
HateUnfairnessEvaluator
ProtectedMaterialEvaluator
IndirectAttackEvaluator
(XPIA)CodeVulnerabilityEvaluator
UngroundedAttributesEvaluator
GroundednessProEvaluator
EciEvaluator
Usage Examples
Backward Compatibility
_evaluate_query
parameter continues to work but shows a deprecation warningevaluate_query
and_evaluate_query
are specifiedself._evaluate_query
) remains the sameBenefits
The parameter controls whether queries are included in evaluation data when evaluating query-response pairs. With this change, users no longer need to rely on private kwargs to access this important functionality.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.