dialogue_turns
dialogue_turns
Extract the real dialogue from a call log. Drops everything that is machinery rather than speech:
entries whose role isn’t in roles, entries carrying tool_calls, and empty content. The
system, system-log, tool, and assistant-manual roles are all excluded by default.
drop_echo handles one engine behavior. The chat engine appends its own post-prompt output to
call_log as a bare role: assistant entry, indistinguishable by role from real speech. Replayed
into another medium, the agent would narrate a summary of itself. It is identifiable only by
content, being identical to post_prompt_data.raw, which is what this parameter compares against.
Parameters
call_log
The log, as delivered in call_log, raw_call_log, or raw_messages. A non-list value yields
[].
roles
Roles to keep. Keyword-only. The default is exported as DIALOGUE_ROLES.
drop_echo
Exact content to treat as the summary echo and drop. Keyword-only.
Returns
list[dict[str, str]] — {"role", "content"} pairs in order.
Example
Part of the post-prompt normalization module.