Skip to main content

Module messages

Module messages 

Source
Expand description

Stage 1โ€“2: shaping the conversation itself.

Both transforms rewrite the messages array and nothing else. They are paired in shape_messages because they are the contiguous run of message-level work in the pipeline โ€” see [super::apply] for why the order within that run is fixed.

Functionsยง

coalesce_for_capabilities ๐Ÿ”’
Stage 2 โ€” merge consecutive same-role messages for strict-turn models.
log_payload_shape ๐Ÿ”’
Diagnostics for tracking down oversized payloads: the byte cost of every non-message top-level field, and the content size of every message.
shape_messages
Apply every message-level transform, in order.
strip_prior_reasoning ๐Ÿ”’
Stage 1 โ€” scrub reasoning artefacts from prior assistant turns.