Skip to content

inspect_evals_utils.metadata

Read an eval's eval.yaml file.

load_eval_version

load_eval_version(module_file: str | PathLike[str]) -> str

Return the version field of the eval.yaml beside a module.

Call it from the module that defines the eval's tasks:

EVAL_VERSION = load_eval_version(__file__)

The argument is a file path and not a package name because Inspect also loads a task module by file path (inspect eval src/my_eval/my_eval.py), and __package__ does not name the package there.

Parameters:

Name Type Description Default
module_file str | PathLike[str]

Path of a file in the directory that holds eval.yaml.

required

Returns:

Type Description
str

The version string, for example "1-A".

Raises:

Type Description
TypeError

eval.yaml has no version, or YAML read it as a number.