Skip to content

Model Build AI evaluation artifacts at the JSON boundary #316

Closed

Description

@kstonekuan

Current behavior

The Build AI evaluation adapter creates run.json as a dict[str, object] at examples/build_ai_evaluation/evaluate.py:437-473. A saved file is loaded with json.loads() and immediately used through .get() and indexed keys at evaluate.py:482-494.

Per-sample outcomes use one dictionary shape controlled by a free-form status string at evaluate.py:641-672:

  • ok requires predicted_value and no error.
  • invalid requires a parse error and no prediction.
  • error requires an execution error and no prediction.

The summarizer reconstructs those invariants through string comparisons, key lookups, and casts at evaluate.py:543-633. A valid JSON value with the wrong shape can currently escape as AttributeError, KeyError, or a misleading summary.

Verified against main at fbfd553.

Pattern to copy

The direct model boundary in examples/build_ai_evaluation/judgment.py:43-69 already uses explicit parsed and unparsed variants. model_output_check_result() consumes them with an exhaustive match.

What to build

Introduce focused internal domain types for run metadata and the three sample outcomes. Parse run.json into the metadata type at the file boundary. Make _sample_result() return an explicit union and make summary computation consume that union.

Keep dictionaries at JSON serialization boundaries. Preserve the current run.json and summary.json schemas so existing experiment directories and comparison commands continue to work.

Definition of done

  1. Successful, invalid-response, and execution-error samples are exclusive variants.
  2. Only the successful variant can carry predicted_value.
  3. Invalid and error variants carry their respective error text.
  4. Run metadata is parsed once from saved JSON and is a typed value downstream.
  5. A non-object or malformed saved run.json raises ValueError naming the file and the bad field.
  6. Matching fingerprints still resume an experiment. Different fingerprints still refuse the output directory.
  7. The current summary values and serialized JSON keys are unchanged for the existing mixed-outcome fixture.
  8. Summary logic no longer branches on free-form sample status strings or casts run metadata.

Non-goals

  • Building a shared framework for the other evaluation examples
  • Changing Inspect log formats
  • Changing prompts, scoring, or summary formulas
  • Adding Pydantic or another dependency

Validation

uv sync --locked --project examples/build_ai_evaluation
uv run --locked --project examples/build_ai_evaluation \
  ruff check --fix examples/build_ai_evaluation
uv run --locked --project examples/build_ai_evaluation \
  ruff format examples/build_ai_evaluation
uv run --locked --project examples/build_ai_evaluation \
  ty check --project examples/build_ai_evaluation --extra-search-path . \
  examples/build_ai_evaluation
uv run --locked --project examples/build_ai_evaluation \
  pytest -q examples/build_ai_evaluation/tests

Activity

  1. added
    enhancementNew feature or request
    help wantedExtra attention is needed
    advancedNeeds codebase familiarity; not a starter issue
    on Aug 31, 2026
  2. Sagar-024 commented on Aug 31, 2026

    @Sagar-024
    Contributor

    Taking this. Same JSON-boundary pattern as #317, which I have open for
    the EgoSuite adapter. Exclusive outcome variants, metadata parsed once
    at load, judgment.py:43-69 as the model. Keeping the two implementations
    separate per the no-shared-framework non-goal.

    PR after #317 lands so I don't stack two big reviews at once.

  3. added a commit that references this issue on Sep 1, 2026
    003303d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    advancedNeeds codebase familiarity; not a starter issueenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions