fix(evals): tolerate null evaluatorConfig in evaluator creation#1713
fix(evals): tolerate null evaluatorConfig in evaluator creation#1713ajay-kesavan wants to merge 2 commits into
Conversation
The C# layer (EvaluatorConfigDto) sends evaluatorConfig: null when omitted.
The name/description merge in GenericBaseEvaluator.validate_model then crashes
with TypeError ('NoneType' object does not support item assignment), failing
every evaluator at creation time and killing the run with 0 evals.
Treat a null evaluatorConfig as {} so config defaults apply and the existing
criteria fallback chain (item criteria -> config default) works.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes evaluator instantiation failures when the C# layer sends evaluatorConfig: null by normalizing null configs to {} during Pydantic model validation, preventing TypeError during name/description merging and allowing eval runs to proceed.
Changes:
- Normalize
evaluatorConfig: nullto{}inGenericBaseEvaluator.validate_modelbefore merging top-levelname/description. - Add regression tests covering evaluator creation when
evaluatorConfigis explicitlynullandname/descriptionare provided at the top level.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/uipath/src/uipath/eval/evaluators/base_evaluator.py | Treats evaluatorConfig: null as {} during pre-validation to avoid crashes when merging metadata. |
| packages/uipath/tests/evaluators/test_evaluator_factory.py | Adds tests to ensure evaluator creation tolerates evaluatorConfig: None with top-level name/description. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # The C# layer sends evaluatorConfig: null when omitted — treat as {} | ||
| if values.get("evaluatorConfig", {}) is None: | ||
| values["evaluatorConfig"] = {} | ||
| if "description" in values and "evaluatorConfig" in values: | ||
| values["evaluatorConfig"]["description"] = values.pop("description") |
2.10.81 is already published to PyPI; CI version-uniqueness check requires a free version for this change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
🚨 Heads up:
|



Problem
The C# layer (
EvaluatorConfigDto.EvaluatorConfigisJsonElement?) sendsevaluatorConfig: nullwhen the config is omitted. The name/description merge inGenericBaseEvaluator.validate_modelthen does:which crashes with
TypeError: 'NoneType' object does not support item assignment. Every evaluator fails at creation time, so eval runs die with 0 evals / Failed before any evaluation executes.Fix
Treat a null
evaluatorConfigas{}(3 lines invalidate_model). Config fields all have defaults (default_evaluation_criteriabecomesNone), so the existing criteria fallback chain — per-item criteria → configdefault_evaluation_criteria— keeps working unchanged.Testing
tests/evaluators/test_evaluator_factory.pycoveringevaluatorConfig: nullwith top-levelnameanddescriptionpytest tests/evaluators/— 92 passed🤖 Generated with Claude Code