pub struct PromptResponse {
pub usage: Usage,
pub completion_calls: Vec<CompletionCall>,
pub messages: Vec<Message>,
pub content: Vec<AssistantContent>,
/* private fields */
}Expand description
Final run output and accounting, returned by awaited runs and terminal
MultiTurnStreamItem::FinalResponse stream items.
Fields§
§usage: UsageAggregated token usage across the whole run.
completion_calls: Vec<CompletionCall>Successfully completed completion requests made by this agent run.
usage remains the aggregate across the whole run. Use the last
entry’s usage to inspect the final completion request’s prompt/context
length. An entry whose counters are all None means the provider
reported no usage metrics for that request.
messages: Vec<Message>The run’s transcript: the prompt, every accepted assistant turn, every committed tool result and the corrective feedback of any retried turn, excluding the input history the run started from: what a caller keeping the conversation appends to it. Empty only for a response built without a run behind it.
content: Vec<AssistantContent>Structured assistant content for the final turn: its text,
reasoning, images, and other parts. In output-tool mode the model’s
prose and tool calls are replaced by one text part holding the
serialized structured output. output is derived
from it.
Implementations§
Source§impl PromptResponse
impl PromptResponse
Sourcepub fn new(output: impl Into<String>, usage: Usage) -> Self
pub fn new(output: impl Into<String>, usage: Usage) -> Self
A response whose final turn is the single text part output, with the
run’s usage.
Sourcepub fn output_tool_calls(&self) -> usize
pub fn output_tool_calls(&self) -> usize
How many times the output tool was called.
Sourcepub fn output(&self) -> String
pub fn output(&self) -> String
The concatenated text parts of content. In
output-tool mode this is the serialized structured output.
Sourcepub fn content(&self) -> &[AssistantContent]
pub fn content(&self) -> &[AssistantContent]
The structured assistant content for the final turn (see the field).
Sourcepub fn completion_calls(&self) -> &[CompletionCall]
pub fn completion_calls(&self) -> &[CompletionCall]
Returns successfully completed completion requests made by this agent run.
An entry whose counters are all None means the provider reported no
usage metrics for that request.