Expand description
Slot resolution — turning IR 0.7’s declared slots into the text a model actually receives.
The IR carries every variant and selects none; selecting is the host’s job, and so is answering a
slot’s present_when. This module is the seam between the two: a host hands in a table, and every
{{ slot.<name> }} in the prompt text is replaced before anything is emitted.
Without this the placeholder ships verbatim. The compiler’s template-syntax check cannot
catch that — {{ slot.x }} is valid syntax that simply had no consumer downstream — so the
failure was silent, which is why assert_no_slot_references exists and is not optional.
The scanner mirrors the compiler’s double_brace_bodies / is_slot_name rather than inventing a
pattern of its own: the compiler decides what counts as a reference, and a consumer that
disagreed would either substitute something the compiler never checked or leave behind something
the compiler assumed was handled.
Functions§
- apply_
slots - Apply an already-resolved scope to one piece of prompt text.
- assert_
no_ slot_ references - Refuse prompt text that still carries a slot reference.
- resolve_
ir_ json - Resolve every slot in an IR document, in place, before anything deserializes it into a target-specific type.
- resolve_
slots - Resolve every slot in
declsto the text that replaces its references, or toNonewhen the host said it is not present.
Type Aliases§
- Slot
Supply - What a host says about each slot, keyed by slot name.