#[non_exhaustive]pub struct Message {
pub id: String,
pub kind: String,
pub role: Role,
pub content: Vec<ContentBlock>,
pub model: ModelId,
pub stop_reason: Option<StopReason>,
pub stop_sequence: Option<String>,
pub stop_details: Option<StopDetails>,
pub usage: Usage,
pub context_management: Option<ResponseContextManagement>,
pub container: Option<ContainerInfo>,
}Expand description
A complete (non-streaming) Messages-API response.
Usually produced by the SDK from a wire payload rather than built by
hand. Tests that need a fixture should round-trip a JSON literal through
serde_json::from_value.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringUnique message identifier (e.g. msg_01ABC...).
kind: StringWire type discriminant. Always "message" for non-streaming responses;
retained on the struct for full round-trip fidelity.
role: RoleAuthor of the message. Always Role::Assistant for responses.
content: Vec<ContentBlock>Ordered list of content blocks the model produced.
model: ModelIdThe model that produced this response.
stop_reason: Option<StopReason>Why the model stopped, when known.
stop_sequence: Option<String>The stop sequence that triggered termination, if applicable.
stop_details: Option<StopDetails>Structured information about why the model stopped (e.g. for
refusal stops, the policy category and an explanation). None
when no extra detail is reported.
usage: UsageToken usage and related counters.
context_management: Option<ResponseContextManagement>Context-management edits applied to the request (e.g. trimmed thinking blocks or tool-use history). Present only when a context-management strategy was active and triggered.
container: Option<ContainerInfo>Container metadata, present when the request used the code-execution container tool.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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>,
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more