Skip to main content

Module transcript

Module transcript 

Source
Expand description

The transcript a provider receives: messages in which system messages hold the prompt and tool declarations.

The first message, when it is a system message, is the initial prompt. Later system messages patch sections and add or remove tools. Providers that cannot take system messages mid-conversation get them collapsed into the first one.

Functions§

current_system_message
All system messages folded into one: their text joined, sections merged (a removed then re-added section moves to the end), and the current tools. None when the transcript has no system message and no tools.
current_tools
Tools active at the end of the transcript, in declaration order.
declarations_equal
Whether two declarations serialize identically.
declared_tools
Every tool ever declared, with its latest declaration.
estimate_context_tokens
Tokens the transcript occupies: the last successful assistant usage plus estimates for the messages after it, or estimates throughout.
estimate_message_tokens
Rough token count of one message: characters / 4, images at 4800 characters.
has_non_additive_tool_changes
Whether any system message removes a tool or declares a name a second time.
has_tool_redefinitions
Whether a tool name is declared twice with different declarations.
initial_system_message
The leading system message, if the transcript starts with one.
resolve_transcript
The transcript as a provider sees it: unchanged when it accepts mid-conversation system messages, otherwise with every system message collapsed into the first.
resolve_transcript_tools
Tools for the top-level request field, and whether later system messages keep their own additions in place. Anchoring needs API support and a transcript that only ever adds tools. Otherwise the request lists the current tools.
tool_state_changes
Declarations to add and names to remove to get from previous to current. A changed declaration is both removed and added.
transform_messages
Rewrites a transcript for model:

Type Aliases§

NormalizeToolCallId
Maps a tool-call id from another model to one the target API accepts, given the assistant message that made the call.