Introduces the sample of the teacher’s data file. Also how the test-mode mock Azure API finds
the sample, which it needs to answer with the field names the teacher’s file actually has.
Caps for how much validation detail is echoed back to the model and the teacher; union
schemas like Vega-Lite’s can produce very many, very long errors.
Stands in for the teacher’s file while a spec that has none is validated. The Vega-Lite schema
requires a data source on a top-level view, so a chart still waiting for its file could not be
checked at all otherwise. Never leaves parse_and_validate_spec.
User prompt prefix. Also how the test-mode mock Azure API recognises a request from this
feature, since a JSON-mode request carries no schema name to identify it by.
Vendored copy of https://vega.github.io/schema/vega-lite/v6.json, used to validate
generated specs without network access. All of its $refs are internal.
Generate a Vega-Lite chart specification from a teacher’s prompt using an LLM with
structured JSON output. The result is validated against the Vega-Lite v6 JSON Schema;
on failure the validation errors are sent back to the model for one repair round.
Returns the specification pretty-printed as a JSON string.
Parses one LLM answer, rejects any data the model supplied, attaches data_file and validates
the result against the Vega-Lite schema. The error string describes the failure in a form
suitable for feeding back to the model.