Skip to main content

inspect-evals-utils

Runtime helpers for Inspect AI evaluations, moved out of inspect_evals so that a standalone eval repo can use them without depending on the whole registry. inspect_evals will depend on this package and re-export everything under its old inspect_evals.utils paths, so existing imports keep working.

Install

uv add inspect-evals-utils
# or, for the Hugging Face wrappers:
uv add "inspect-evals-utils[huggingface]"

Modules

  • inspect_evals_utils.ids: create_stable_id, filter_duplicate_ids, drop_known_broken, require_optional_dependency, DuplicateIdError, KnownBrokenSampleError.
  • inspect_evals_utils.datasets: load_json_dataset and load_csv_dataset, which cache remote files and retry transient errors, plus cache_dataset_loader, is_remote_url, get_cached_fname, is_transient_error.
  • inspect_evals_utils.huggingface (needs the huggingface extra): hf_dataset, load_dataset, get_dataset_split_names, snapshot_download, hf_hub_download, sentence_transformer, transformers_pipeline, auto_model_for_sequence_classification, auto_tokenizer. Each retries on rate limits and transient errors and requires a revision= keyword, so datasets are pinned. set_backoff_config changes the retry policy for later calls (the default is CI_BACKOFF_CONFIG when the CI environment variable is set, otherwise STANDARD_BACKOFF_CONFIG). set_hf_call_recorder and set_backoff_recorder register callbacks that test sessions use to count calls and retries; both default to doing nothing.
  • inspect_evals_utils.code: extract_code_blocks, extract_code_block, strip_json_fence, defines.
  • inspect_evals_utils.scorers: the ScoreReason constants (GRADER_FAILED, SCORING_FAILED, NO_RESPONSE, REFUSAL, INVALID_RESPONSE_FORMAT) and GraderFailureMode with its constants, moved from inspect_evals.utils.scorers; and the free-text verdict parser find_verdict, parse_verdict, VerdictMatch, VerdictParseFailure, with VERDICT_LABEL and verdict_instruction for prompts an eval words itself. The parser reads one value (yes/no, a letter, one number) from a labelled line or a leading token, with a required position and no fallback verdict.
  • inspect_evals_utils.messages: message_content_text, reasoning_to_text.
  • inspect_evals_utils.prompts: Prompt, a dataclass recording a prompt with its provenance.
  • inspect_evals_utils.shuffle: shuffle_and_seed.
  • inspect_evals_utils.cache: cache_path() and INSPECT_EVALS_CACHE_PATH.

The most-used names are also importable from the top level, for example from inspect_evals_utils import create_stable_id. The Hugging Face module is not, so the base package imports without the extra.

Cache directory

Downloads land in INSPECT_EVALS_CACHE_PATH, which defaults to the platform user cache directory for inspect_evals. Set INSPECT_EVALS_CACHE_DIR to move it or point it at a pre-populated directory. It must be absolute or start with ~, and it is read once when the package is imported. inspect_evals reads the same variable and default, so one machine has one cache.

README generation

The inspect-evals-readmes command rewrites the generated sections of each eval's README (Contributors, Usage, Options and Parameters) from its eval.yaml and @task signatures. It finds evals as <src>/<eval>/eval.yaml (default src), imports each package to read the task parameters, and writes between the <!-- Usage: Automatically Generated --> style tag pairs.

uv run inspect-evals-readmes generate                      # rewrite the sections
uv run inspect-evals-readmes generate --check              # exit 1 if any README is out of date; writes nothing
uv run inspect-evals-readmes generate --eval my_eval --create-missing
uv run inspect-evals-readmes add-section --key Parameters --insert-after Options

add-section inserts a missing tag pair after the first listed section it finds, or at the end of the file.

Private inspect_ai APIs

inspect_evals_utils.datasets uses inspect_ai._util.file.file to open local and remote files through one interface. There is no public equivalent yet, so a future inspect_ai release could break it.

Development

uv sync
uv run pre-commit install   # optional: run the lint stack on every commit
uv run pytest
uv run basedpyright src

Each pull request adds a changelog fragment rather than editing CHANGELOG.md, so concurrent PRs don't conflict. Run uv run scriv create, uncomment the sections that apply in the new file under changelog.d/, and commit it with the change, or delete it if the change needs no entry. To release, run the Prepare release workflow from the Actions tab. It bumps version in pyproject.toml, collects the fragments into CHANGELOG.md, and opens a release pull request, whose CI starts once you click Approve workflows to run on it; merging it tags the release. It needs Settings → Actions → General → Allow GitHub Actions to create and approve pull requests. By hand, the same is uv version --bump minor and uv run scriv collect.

Linting (ruff, zizmor, mdformat) runs via pre-commit; CI runs the same stack plus basedpyright and pytest via the shared python-ci reusable workflow.

Releasing

See RELEASING.md.

Metadata

Release files for inspect-evals-utils 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inspect-evals-utils 0.2.0
File Size Uploaded Provenance Actions
inspect_evals_utils-0.2.0.tar.gz 34.5 kB With provenance Details for inspect_evals_utils-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inspect-evals-utils 0.2.0
File Interpreter ABI Platform Actions
inspect_evals_utils-0.2.0-py3-none-any.whl Python 3 none any Details for inspect_evals_utils-0.2.0-py3-none-any.whl

Total release size: 73.2 kB

Release files / inspect_evals_utils-0.2.0.tar.gz

Download URL inspect_evals_utils-0.2.0.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0e80fa51d903b6b6ec51228f982a411ecbfd285b359f0fb55d417c1d7a2d1a08
BLAKE2b-256 checksum
How to use checksums
8784d6fd7197304ca6b812a8bef2b6986c40679ab11b50d61d7dee444787e393
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / inspect_evals_utils-0.2.0-py3-none-any.whl

Download URL inspect_evals_utils-0.2.0-py3-none-any.whl
Size 38.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8601daba89cbcff4faa1938b00277b6317233f69204ca24f594c04f852c9ab8
BLAKE2b-256 checksum
How to use checksums
381a96faf8b3869373037bd5bb4dac107bc931e8d720bea7378173f977585d50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for inspect-evals-utils 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for inspect_evals_utils-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page