browseruse_bench.utils.config_loader
配置文件加载工具。
from browseruse_bench.utils import (
load_config_file,
resolve_benchmark_config,
load_data_info,
get_default_split,
)
load_config_file
加载 YAML 配置文件。
def load_config_file(path: Path) -> Dict[str, Any]
如果未安装 pyyaml,会使用内置的简化 YAML 解析器(仅支持基础的 key-value)。
resolve_benchmark_config
获取 Benchmark 配置。
def resolve_benchmark_config(
config: Dict[str, Any],
benchmark: str
) -> Dict[str, Any]
benchmark 不存在时会抛出 SystemExit。
使用示例
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
加载 benchmark 的 data_info.json。
def load_data_info(benchmark_path: Path) -> Dict[str, Any]
data_info.json 内容(文件不存在时返回空字典)
get_default_split
获取默认 split。
def get_default_split(data_info: Dict[str, Any]) -> Optional[str]
优先使用 data_info 中的 default_split;否则优先选择 All,再退回到第一个 split key。
使用示例
from browseruse_bench.utils import load_data_info, get_default_split
from pathlib import Path
data_info = load_data_info(Path("benchmarks/lexbench-browser"))
split = get_default_split(data_info) # 例如 "All"