Skip to content

Add an interactive animation of the evaluation process - #320

Merged
m-messer merged 6 commits into
mainfrom
docs/criteria-graph-images
Nov 3, 2026
Merged

m-messer merged 6 commits into
mainfrom
docs/criteria-graph-images

Conversation

@m-messer

@m-messer m-messer commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Problem

The static process graphs in app/docs/process_graphs/ show which functions evaluation_function calls, but not the order of the calls, the values passed between them, or how each criterion becomes a criteria graph and is evaluated. That makes the evaluation hard to follow for anyone new to the code.

Changes

  • scripts/generate_process_animation.py (new): records the same examples as the static figures and writes a self-contained page to build/process_animation.html. The build/ folder is git-ignored. Run it with python -m scripts.generate_process_animation.
    • The calls graph grows in call order. It has play, step and scrub controls, a call depth from 1 to 5, and zoom.
    • The side panel shows:
      • the current stage and how long it took;
      • each call's docstring, source location, arguments and return value, or the exception it raised;
      • the parameters the context added;
      • the forms the response took.
    • An optional criteria view shows how each criterion is chosen: it is parsed, its parse label selects a template, and the template builds the criteria graph. It then shows the path each criteria graph took, and which criterion produced each tag of the result.
    • Clicking a node, or a tag or criterion link in the panel, moves to the step that makes that node current.
    • "Hide internals" (on by default) leaves out dunder calls. A legend explains the colours and edges. Panel sections can be collapsed, and the settings persist in localStorage.
    • Besides the three documented examples, there are three that only the animation uses: an incorrect response, syntactical_comparison (two criteria), and a criterion that falls back to the context's default template.
    • The page is about 4.7 MB, because the 20 graphviz layouts for each example are gzipped and unpacked in the browser.
  • scripts/generate_process_graphs.py:
    • Values: readable summaries of contexts, EvaluationResult and large dicts, and parse trees drawn with connectors.
    • Calls: the exception a call raised, captured with sys.monitoring PY_UNWIND, plus each call's docstring and source location.
    • Recording: the parameter, feedback and timing events, and an option for calls_to_dot to hide internal calls.
    • Static SVGs: they are byte-identical to before.

Notes

  • Timings: they are measured while every call is being recorded, so they are much longer than in a normal evaluation. The page says so.
  • Exception messages: these, and any other recorded values, appear only in the locally built page. Nothing is logged.
  • Graph regeneration: this PR changes scripts/generate_process_graphs.py, so the documentation graphs workflow from Regenerate the documentation graphs on pull requests #318 will run on it. It should find no SVG changes.

Checklist

  • Tests added/updated: not applicable, since only the generator scripts change. The existing suite passes (1240 passed, 2 skipped, 1 xfailed). The page was checked in headless Chrome:
    • no JS errors;
    • with internals shown and the criteria graph off, the depth 2 final frame matches process_symbolic_calls.svg;
    • each example ends with the expected result;
    • light and dark themes, and phone width.
  • Docs updated (app/docs.md) if user-facing behaviour changed: not applicable, since there is no user-facing change.

🤖 Generated with Claude Code

m-messer and others added 6 commits November 3, 2026 16:00
scripts/generate_process_animation.py writes build/process_animation.html,
which grows each example's calls graph in call order. A side panel shows
the response's forms, each call's arguments and return value, and the
criteria graph traversal, with toggles and a call depth selector.

The recorder in generate_process_graphs.py now keeps an ordered event log
with argument and return values, records to a configurable depth, and
catches criteria graph evaluations. The static figures are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s clickable

The recorder now records the criteria create_criteria_dict parses and the
template feedback_procedure_generator chooses for each one. With the
criteria graph shown, the animation adds a node for each criterion in the
parse_criteria stage, an edge labelled with its parse label to the template
it chooses, and edges to its criteria graph from the template that builds
it and the stage that runs it. A Criteria panel section follows the chain
from the criteria string to whether each graph reached its main criterion.

Clicking a node pins its details in the panel: a call's invocations with
their arguments and return values, a stage's calls, a criteria graph node's
details and whether it was reached, or a criterion's chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Internal dunder calls are hidden by default, values and parse trees are summarised, and the panel's sections can be
collapsed. The criteria graph is drawn beside the generate_feedback stage. The page gains a legend, the parameters
the context added, where each feedback tag came from, stage timings, the type of a raised exception, and each call's
docstring and source location. Three animation-only examples cover an incorrect response, syntactical comparison and
the default template. The layouts are gzipped to keep the page small.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clicking a node, or a tag or criterion link in the panel, makes that node the current node. A criteria graph criterion
or output moves to the evaluation that reached it. The call section takes over the source location, the full values
and the later calls from the pinned view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@m-messer
m-messer merged commit 6f29fd3 into main Nov 3, 2026
1 of 2 checks passed
@m-messer
m-messer deleted the docs/criteria-graph-images branch November 3, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant