-
[OPIK-2632] [P SDK] Alternative way to configure evaluation metrics (#3893)
发布于
2025-11-05 12:11:00 +00:00 - [OPIK-2632] [P SDK] Add Scorer Function and Wrapper Metric for Scoring Evaluation
- Introduced
ScorerFunctionandAsyncScorerFunctionto standardize scoring interface for evaluation tasks. - Added
ScorerWrapperMetricto integrate scoring functions into theBaseMetricframework. - Implemented
validate_scorer_functionto ensure proper scorer function signature. - Created unit tests to validate scorer function behavior and adherence to expected parameters.
-
[OPIK-2632] [P SDK] Fixed error messages.
-
[OPIK-2632] [P SDK] Fixed linter errors
-
[OPIK-2632] [P SDK] Extend scorer function support for evaluation metrics
- Added task_span-related parameter handling to scorer functions and updated
ScorerWrapperMetric. - Introduced
ScorerWrapperMetricTaskSpanfor metrics requiring task span inputs. - Updated evaluation logic in
evaluate_taskto support dynamic wrapping of scorer functions into metrics. - Refactored internal validation and scoring logic to streamline metric calculations with task span support.
- [OPIK-2632] [P SDK] Expand scorer function output flexibility and enhance evaluation logic
- Updated scorer function interfaces to support multiple results (
ScoreResultorList[ScoreResult]). - Modified
wrap_scorer_functionsto return a list ofBaseMetricobjects for extended metric integration. - Extended
evaluate_experimentto handle scorer functions alongside scoring metrics, enhancing evaluation flexibility and supporting dual input mechanisms.
- [OPIK-2632] [P SDK] Enhance scorer function validation and extend evaluation tests
- Updated
validate_scorer_functionto support more flexible parameter validation, allowing functions withtask_spanand/orscoring_inputsandtask_outputs. - Enhanced error messages for improved clarity.
- Added extensive unit and end-to-end tests to validate new scorer function behaviors, including combinations of parameters with
task_span.
-
[OPIK-2632] [P SDK] Relaxed LangChain usage check
-
[OPIK-2632] [P SDK] Added documentation with examples of how to use scoring functions
-
[OPIK-2632] [P SDK] Fixed typo
-
[OPIK-2632] [P SDK] Fixed typo
-
[OPIK-2632] [P SDK] Added
scoring_functionsparameter toevaluate_promptmethod. -
[OPIK-2632] [P SDK] Replaced
scoring_inputswithdataset_itemfor consistency and extended evaluation logic
- Standardized parameter naming across scorer functions by replacing
scoring_inputswithdataset_item. - Updated scorer function validation, associated tests, and documentation to reflect the parameter change.
- Refactored evaluation logic to simplify scoring function wrapping with a new
_wrap_scoring_functionsutility.
- [OPIK-2632] [P SDK] Replaced
scoring_inputswithdataset_itemin docstrings
下载附件