pub struct StepResult {
pub step_number: u32,
pub runtime_context: Option<JsonValue>,
pub tools_context: Option<JsonValue>,
pub model: ModelIdentity,
pub content: Vec<StepContent>,
pub finish_reason: FinishReason,
pub usage: Usage,
pub warnings: Vec<Warning>,
pub request: StepRequest,
pub response: StepResponse,
pub provider_metadata: Option<ProviderMetadata>,
pub performance: StepPerformance,
}Expand description
The result of one step: a model call plus the tool executions it caused.
Fields§
§step_number: u32Zero-based step index.
runtime_context: Option<JsonValue>Application state used for this step (never sent to the provider).
tools_context: Option<JsonValue>Shared tool context used for this step, before per-tool validation.
model: ModelIdentityModel that produced the step.
content: Vec<StepContent>Content parts in order.
finish_reason: FinishReasonWhy the model stopped.
usage: UsageToken usage of the model call.
warnings: Vec<Warning>Warnings produced by the adapter.
request: StepRequestRequest metadata (body and messages when included).
response: StepResponseResponse metadata and the messages to append to the history.
provider_metadata: Option<ProviderMetadata>Provider-specific metadata.
performance: StepPerformanceTiming and throughput.
Implementations§
Source§impl StepResult
impl StepResult
Sourcepub fn reasoning_text(&self) -> Option<String>
pub fn reasoning_text(&self) -> Option<String>
Concatenates all reasoning parts, or None when there is none.
Sourcepub fn tool_calls(&self) -> impl Iterator<Item = &ParsedToolCall> + '_
pub fn tool_calls(&self) -> impl Iterator<Item = &ParsedToolCall> + '_
Iterates over the tool calls of the step.
Sourcepub fn static_tool_calls(&self) -> impl Iterator<Item = &ParsedToolCall> + '_
pub fn static_tool_calls(&self) -> impl Iterator<Item = &ParsedToolCall> + '_
Tool calls to tools of the static tool set.
Sourcepub fn dynamic_tool_calls(&self) -> impl Iterator<Item = &ParsedToolCall> + '_
pub fn dynamic_tool_calls(&self) -> impl Iterator<Item = &ParsedToolCall> + '_
Tool calls to dynamic tools (including invalid calls).
Sourcepub fn tool_results(&self) -> impl Iterator<Item = &ToolResult> + '_
pub fn tool_results(&self) -> impl Iterator<Item = &ToolResult> + '_
Iterates over the (final) tool results of the step.
Sourcepub fn tool_errors(&self) -> impl Iterator<Item = &ToolExecutionError> + '_
pub fn tool_errors(&self) -> impl Iterator<Item = &ToolExecutionError> + '_
Iterates over the tool errors of the step.
Sourcepub fn tool_approval_requests(
&self,
) -> impl Iterator<Item = &ToolApprovalRequestContent> + '_
pub fn tool_approval_requests( &self, ) -> impl Iterator<Item = &ToolApprovalRequestContent> + '_
Iterates over the approval requests of the step.
Sourcepub fn files(&self) -> impl Iterator<Item = &GeneratedFile> + '_
pub fn files(&self) -> impl Iterator<Item = &GeneratedFile> + '_
Iterates over generated files.
Sourcepub fn response_messages(&self) -> Vec<Message>
pub fn response_messages(&self) -> Vec<Message>
The messages to append to the conversation history.
Sourcepub fn tool_result_as<T: DeserializeOwned>(
&self,
tool_name: &str,
) -> Result<Option<T>, Error>
pub fn tool_result_as<T: DeserializeOwned>( &self, tool_name: &str, ) -> Result<Option<T>, Error>
Deserializes the output of the first final result of tool_name.
§Errors
Returns the deserialization error; Ok(None) when no such result
exists.
Trait Implementations§
Source§impl Clone for StepResult
impl Clone for StepResult
Source§fn clone(&self) -> StepResult
fn clone(&self) -> StepResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more