Skip to content

Fixed intermittent pydantic validation error in canonical evaluator#119

Open
panasenco wants to merge 1 commit intoawslabs:mainfrom
panasenco:fix-reasoning-none-validation-error
Open

Fixed intermittent pydantic validation error in canonical evaluator#119
panasenco wants to merge 1 commit intoawslabs:mainfrom
panasenco:fix-reasoning-none-validation-error

Conversation

@panasenco
Copy link
Copy Markdown

The _extract_content_from_xml method in the canonical evaluator was returning None for missing XML elements.
When the evaluator's LLM didn't include <thinking></thinking> tags in its response, this caused a pydantic validation
error because TestResult.reasoning expects a string, not None.

Should resolve #98 - certainly resolved that bug for me. I went from experiencing it 30% of the time to not at all.

Changes made

Changed line 90 in src/agenteval/evaluators/canonical/evaluator.py:

Before:

content.append(match.group(1).strip() if match else None)

After:

content.append(match.group(1).strip() if match else "")

Tests Updated

  • Updated existing test case that expected (None, None) to expect ("", "")
  • Added new test case specifically for the missing <thinking> tags scenario that was causing the bug

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@panasenco panasenco force-pushed the fix-reasoning-none-validation-error branch from d04107e to 4b9e581 Compare March 4, 2026 16:44
…y fixing _extract_content_from_xml to return "" instead of None for missing elements.
@panasenco panasenco force-pushed the fix-reasoning-none-validation-error branch from 4b9e581 to a6a6c17 Compare March 4, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid type for parameter inputText, value: None, type: <class 'NoneType'>, valid types: <class 'str'>

1 participant