pub struct ModelResponse {
pub text: TextPayload,
pub tool_calls: Vec<ToolCallDraft>,
}Expand description
The model door’s fact shape: what the model said (text) and asked (tool calls). Named for the participant, not for any wire role.
Fields§
§text: TextPayloadWhat the model said. Blank text produces no fact block on commit.
tool_calls: Vec<ToolCallDraft>What the model asked for, in its draft order; ids are assigned at commit.
Implementations§
Source§impl ModelResponse
impl ModelResponse
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Counts one block for nonblank text, plus one per tool declaration.
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.
Text precedes declarations, which retain their original order, arguments, names and provider identifiers. Blank text is omitted; other text is preserved verbatim. Duplicate block identities are checked on context submission rather than here. MaxTokens and Refusal policy belongs to the caller.
Trait Implementations§
Source§impl Clone for ModelResponse
impl Clone for ModelResponse
Source§impl Debug for ModelResponse
impl Debug for ModelResponse
Source§impl<'de> Deserialize<'de> for ModelResponse
impl<'de> Deserialize<'de> for ModelResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ModelResponse
impl RefUnwindSafe for ModelResponse
impl Send for ModelResponse
impl Sync for ModelResponse
impl Unpin for ModelResponse
impl UnsafeUnpin for ModelResponse
impl UnwindSafe for ModelResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more