browseruse_bench.utils.eval_utils
Evaluation-related utility functions and classes.Import
EvaluationModel
OpenAI model wrapper class for task evaluation.str
default:"gpt-4o"
Model name
str
default:"None"
API Key, defaults to environment variable
str
default:"None"
API Base URL, defaults to environment variable
generate
Generate evaluation response with automatic retry.load_evaluation_model
Load evaluation model with environment variable fallback.Configuration
The eval model is configured in the rootconfig.yaml under the eval: section:
api_key and base_url accept $VAR placeholders resolved from .env.
encode_image
Convert a PIL image to base64 string.PIL.Image
required
PIL Image object
float
default:"1.0"
Image scale factor (between 0.0 and 1.0), e.g., 0.5 means 50% size
extract_score_from_response
Extract numerical score from evaluation response.str
required
Evaluation response text
int
Extracted score (0 if not found)
calculate_success
Determine if task is successful based on score threshold.int
required
Task score
int
default:"60"
Success threshold
bool
True if score meets or exceeds threshold
normalized_results_file
Context manager that yields a path guaranteed to be JSONL format.Path
required
Results file path