Skip to main content

Module engine

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§

NarrativeResult
The outcome of a narrate call: 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.
SheetFacts
The fact-sheet evidence a narration is grounded in: the canonical text the model reads (and keys the cache on) and the numeric values the reply’s citations are checked against. Both are derived together from one fact sheet, so they travel together into narrate.

Functions§

narrate
Produce a grounded advisory narrative for facts under lens, 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.