Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Refactor response handling in judge system evaluation

Magnus Müller344b35aa7971
diff --git a/eval/judge_system.py b/eval/judge_system.py
index a911fd1d9..dd8d8ea2a 100644
--- a/eval/judge_system.py
+++ b/eval/judge_system.py
@@ -422,15 +422,7 @@ Evaluate this agent execution given the criteria and respond with the exact JSON
try:
response = await model.ainvoke(messages, output_format=JudgeResult)
logger.info(f'Judge response: {response}')
- # Extract the structured data from the completion response
- if hasattr(response, 'completion') and isinstance(response.completion, JudgeResult):
- # The completion attribute contains the structured JudgeResult
- return response.completion
- else:
- logger.error(
- f'Unexpected response structure: {type(response)}, completion type: {type(response.completion) if hasattr(response, "completion") else "N/A"}'
- )
- return create_fallback_result(task, 'Invalid response structure from model')
+ return response.completion
except Exception as e:
logger.error(f'Judge evaluation failed: {e}')