跳转到主要内容

browseruse_bench.utils.config_loader

Configuration file loading utilities.

Import

from browseruse_bench.utils import (
    load_config_file,
    resolve_benchmark_config,
    load_data_info,
    get_default_version,
)

load_config_file

Load YAML configuration file.
def load_config_file(path: Path) -> Dict[str, Any]
path
Path
必填
Configuration file path
return
dict
Configuration dictionary (empty dict if file not found)
If pyyaml is not installed, a built-in simplified YAML parser is used (supports basic key-value pairs only).

resolve_benchmark_config

Get Benchmark configuration.
def resolve_benchmark_config(
    config: Dict[str, Any],
    benchmark: str
) -> Dict[str, Any]
config
dict
必填
Main configuration dictionary
benchmark
str
必填
Benchmark name
return
dict
Configuration dictionary for the benchmark
Raises SystemExit if benchmark does not exist.

Usage Example

from browseruse_bench.utils import load_config_file, resolve_benchmark_config

config = load_config_file(Path("config.yaml"))
bench_config = resolve_benchmark_config(config, "lexbench-browser")

load_data_info

Load benchmark’s data_info.json.
def load_data_info(benchmark_path: Path) -> Dict[str, Any]
benchmark_path
Path
必填
Path to Benchmark directory
return
dict
Contents of data_info.json (empty dict if file not found)

get_default_version

Get default version.
def get_default_version(data_info: Dict[str, Any]) -> Optional[str]
Prioritizes default_version in data_info, otherwise uses the latest version in version_split.
data_info
dict
必填
Contents of data_info.json
return
str or None
Default version string, None if undetermined

Usage Example

from browseruse_bench.utils import load_data_info, get_default_version
from pathlib import Path

data_info = load_data_info(Path("benchmarks/lexbench-browser"))
version = get_default_version(data_info)  # e.g., "v1.2"