pub struct ModelTurn {
pub head: AssistantMessage,
pub identity: ResponseIdentity,
pub choice: Vec<AssistantContent>,
pub usage: Usage,
pub policy: TurnPolicy,
pub finish_reason: Option<FinishReason>,
pub raw: Value,
}Expand description
A completed model turn fed back to AgentRun::model_response.
Fields§
§head: AssistantMessageThe turn’s origin, stop and provider message, without content.
identity: ResponseIdentityThe response and transport request ids this attempt reported.
choice: Vec<AssistantContent>The assistant content returned by the model.
usage: UsageToken usage reported by the provider for this completion request.
policy: TurnPolicyThe tool policy this attempt was prepared with.
finish_reason: Option<FinishReason>Provider-reported terminal reason for this attempt, when available.
raw: ValueThis attempt’s decoded provider response, recorded on its CompletionCall.
Implementations§
Source§impl ModelTurn
impl ModelTurn
Sourcepub fn from_policy(resp: &CompletionResponse, policy: TurnPolicy) -> Self
pub fn from_policy(resp: &CompletionResponse, policy: TurnPolicy) -> Self
Convert a response using the same attempt’s prepared policy and the
response’s normalized finish reason. policy must be the
PreparedRequest::policy of this
attempt: it alone carries the turn’s tool choice to the Skip gate and
the invalid-call context.
Sourcepub fn new(
head: AssistantMessage,
choice: Vec<AssistantContent>,
usage: Usage,
policy: TurnPolicy,
raw: Value,
) -> Self
pub fn new( head: AssistantMessage, choice: Vec<AssistantContent>, usage: Usage, policy: TurnPolicy, raw: Value, ) -> Self
Create a model turn from response parts, the policy the turn was
prepared with, and the provider’s own response raw (see
Self::raw).