Skip to main content

Module slots

Module slots 

Source
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 decls to the text that replaces its references, or to None when the host said it is not present.

Type Aliases§

SlotSupply
What a host says about each slot, keyed by slot name.