Variable: defaultEnforceConverseAlternation
ts
const defaultEnforceConverseAlternation: (
messages: ConverseMessage[],
policy: "merge" | "filler" | "reject",
) => ConverseMessage[] = enforceConverseAlternation;Defined in: src/batteries/llm/bedrock_converse/helpers.ts:287
Default implementation; alias of enforceConverseAlternation.
Apply Converse's strict user ↔ assistant alternation to an already-ordered turn list.
Parameters
| Parameter | Type | Default value |
|---|---|---|
messages | ConverseMessage[] | undefined |
policy | "merge" | "filler" | "reject" | 'merge' |
Returns
Remarks
Exported and separately testable because it is the single most consequential transformation in this battery, and the one a gateway would otherwise perform invisibly.
'merge'concatenates consecutive same-role turns' content blocks. Lossless: the same blocks in the same order, in one turn — exactly what Converse would have accepted had the caller written it that way.'filler'inserts a placeholder opposite-role turn. LOSSIER — it fabricates model output that never existed — and offered only for callers who need positional stability across turns.'reject'returns the list untouched so Converse's own error surfaces. Use this when AUDITING: a repair applied before dispatch is invisible in the response, which makes a gateway's fix indistinguishable from a vendor's tolerance.