pub struct NonStreamingResponse {
pub message: Message,
pub stop_reason: StreamStopReason,
pub usage: Option<Usage>,
}Expand description
A completed, non-streaming LLM response.
The typed counterpart to a streamed response: instead of a sequence of
StreamEvents, the complete assistant Message, the reason
generation stopped, and the token Usage are delivered in one shot.
Each provider builds this from its own native JSON envelope, so callers
never see provider-specific shapes — exactly mirroring how the streaming
path emits typed events.
Produced by create_message and
create_message_with_options.
Fields§
§message: MessageThe fully assembled assistant message.
Contains the same MessagePart sequence
a stream would accumulate — text blocks, tool calls, etc. Built by the
provider from its native response shape.
stop_reason: StreamStopReasonWhy the model stopped generating.
Mapped by the provider from its native finish/stop field. Drives the agent loop’s decision to continue to tool execution or end the turn.
usage: Option<Usage>Token counts for the request, as reported by the provider.
Extracted from the provider’s native usage field (usage on OpenAI and
Anthropic, usageMetadata on Gemini). None when the provider omits
usage from the response — symmetric with the Option<Usage> carried by
the final MessageDelta event on the
streaming path.
Trait Implementations§
Source§impl Clone for NonStreamingResponse
impl Clone for NonStreamingResponse
Source§fn clone(&self) -> NonStreamingResponse
fn clone(&self) -> NonStreamingResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more