Module engine
Expand description
The narrate orchestrator: the one call that turns a fact sheet into a
grounded advisory narrative.
It ties together the pieces the rest of the layer builds: it derives the
sidecar cache key from the fact-sheet text and the client’s model, serves a
warm cache without touching the model, and on a miss drives the versioned
prompt through the ChatClient, runs the numeric citation check over the
reply, records the result in the cache, and returns it. The groundedness
verdict is surfaced verbatim so a caller can stamp every narrative
grounded ✓ or ⚠ contains uncited claims.
Structs§
- Narrative
Result - The outcome of a
narratecall: the narrative text, its groundedness verdict and unmatched tokens, the model that produced it, and whether it was served from the sidecar cache rather than freshly generated. - Sheet
Facts - The fact-sheet evidence a narration is grounded in: the canonical
textthe model reads (and keys the cache on) and the numericvaluesthe reply’s citations are checked against. Both are derived together from one fact sheet, so they travel together intonarrate.
Functions§
- narrate
- Produce a grounded advisory narrative for
factsunderlens, consulting — and populating — the sidecar cache. - stamp
- The inline advisory stamp for
result: it names the model and states whether every number the narrative quoted was grounded in the fact sheet, naming the uncited tokens (up to [STAMP_UNCITED_PREVIEW]) when it was not.