pub struct ModelResponse {
pub items: Vec<ModelItem>,
}Expand description
The model door’s fact shape: what the model produced, as an ordered list of items. One item becomes one block on commit, in item order. Named for the participant, not for any wire role.
Serializable for logs and tests; the serialized form is not part of the stable set and may change in any release.
Fields§
§items: Vec<ModelItem>What the model said and asked, in the order the provider returned it.
Implementations§
Source§impl ModelResponse
impl ModelResponse
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Counts the blocks to_blocks produces: one per item, except that a
Parts item whose parts are all zero-length text produces none.
Sourcepub fn to_blocks(
&self,
stop_reason: ModelStopReason,
block_ids: &[BlockId],
) -> Result<Vec<ContextBlock>, ModelBlockError>
pub fn to_blocks( &self, stop_reason: ModelStopReason, block_ids: &[BlockId], ) -> Result<Vec<ContextBlock>, ModelBlockError>
Validates and constructs material without changing or consuming inputs.
One item becomes one block, in item order. A Parts item becomes a
Parts block and a tool-call item a ToolCall block carrying its
provider identifier. An item’s wire is copied to the block’s
BlockMeta::wire. Only zero-length text parts are omitted
(whitespace-only text is kept verbatim); a Parts item left with no
parts produces no block and its wire is dropped. The kernel never
reads wire or sealed items. Duplicate block identities are checked
on context submission rather than here. MaxTokens and Refusal policy
belongs to the caller.
Source§impl ModelResponse
impl ModelResponse
Sourcepub fn tool_calls(&self) -> impl Iterator<Item = &ToolCallDraft>
pub fn tool_calls(&self) -> impl Iterator<Item = &ToolCallDraft>
The tool calls the model asked for, in item order; ids are assigned at commit.