Refactor the D&D spells module to apply deterministic fields where appropriate

This commit is contained in:
2026-07-08 10:43:39 -05:00
parent 610bdb4fea
commit 98b03a4629
12 changed files with 324 additions and 37 deletions

View File

@@ -14,8 +14,10 @@ This document is the durable raw output contract for the implemented
- Media type: `application/json`
The extractor requires source chunks and transcript source capability. It
returns the structured LLM response as raw JSON. The default `appendorder`
merger passes a single chunk output through and concatenates multiple
returns canonical spell-cast JSON derived from the structured LLM response. The
extractor assigns source IDs deterministically and keeps source-unit ranges as
model-authored evidence locations. The default `appendorder` merger passes a
single chunk output through and concatenates multiple
`spell_casts` arrays in chunk order. The default `noop` normalizer passes the
merge output through unchanged.
@@ -76,7 +78,8 @@ Each spell cast contains:
- `spell`: spell name;
- `effect`: concise spell effect in the scene;
- `narrative_description`: short description of the spell cast in context;
- `source_refs`: transcript source references supplied by the model.
- `source_refs`: transcript source references with extractor-assigned source
IDs and model-supplied unit ranges.
`caster` is the in-world caster, not the transcript speaker.
@@ -88,8 +91,10 @@ Each source reference uses the generic source-reference shape:
- `start_unit_id`
- `end_unit_id`
The extractor prompt and schema use integer `start_unit_id` and `end_unit_id`
values matching source-unit IDs.
The LLM-facing prompt schema asks only for integer `start_unit_id` and
`end_unit_id` values matching source-unit IDs. `source_id` is assigned by the
extractor from the source document ID before validation and output, and is
required in this durable output contract.
## References