pub struct AgentResponseUpdate {
pub contents: Vec<Content>,
pub role: Option<Role>,
pub author_name: Option<String>,
pub response_id: Option<String>,
pub message_id: Option<String>,
pub conversation_id: Option<String>,
pub created_at: Option<String>,
pub finish_reason: Option<FinishReason>,
pub continuation_token: Option<ContinuationToken>,
pub operation_state: Option<OperationState>,
pub additional_properties: HashMap<String, Value>,
pub raw_representation: Option<Value>,
}Expand description
A single streaming chunk from an agent run.
Fields§
§contents: Vec<Content>§role: Option<Role>§response_id: Option<String>§message_id: Option<String>§conversation_id: Option<String>Service-side conversation id carried by the underlying chat update
(Responses / Assistants / Azure AI service-managed conversations).
Preserved so aggregating a streamed run via
AgentResponse::from_updates yields the same
AgentResponse::conversation_id a non-streaming run() returns.
created_at: Option<String>§finish_reason: Option<FinishReason>Why the model stopped, when this update is the one that carries it.
Preserved so aggregating a streamed run via
AgentResponse::from_updates yields the same
AgentResponse::finish_reason a non-streaming run() returns.
continuation_token: Option<ContinuationToken>The handle for resuming a long-running operation. See
ChatResponseUpdate::continuation_token.
operation_state: Option<OperationState>Where the resumable operation stands. See
ChatResponseUpdate::operation_state.
additional_properties: HashMap<String, Value>Provider-specific metadata for this update. Merged onto
AgentResponse::additional_properties during aggregation.
raw_representation: Option<Value>The raw provider payload this update was decoded from, if retained.
Implementations§
Source§impl AgentResponseUpdate
impl AgentResponseUpdate
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
The concatenated text of this update.
Empty when the update carries a refusal fragment — see
ChatResponse::text.
Sourcepub fn has_refusal(&self) -> bool
pub fn has_refusal(&self) -> bool
Whether this update carries a provider refusal fragment.
Sourcepub fn refusal_text(&self) -> Option<String>
pub fn refusal_text(&self) -> Option<String>
This update’s refusal text, or None.
Sourcepub fn user_input_requests(&self) -> Vec<&FunctionApprovalRequestContent>
pub fn user_input_requests(&self) -> Vec<&FunctionApprovalRequestContent>
The user-input (function-approval) requests carried by this update.
Mirrors Python AgentResponseUpdate.user_input_requests.
Sourcepub fn from_chat_update(u: &ChatResponseUpdate) -> AgentResponseUpdate
pub fn from_chat_update(u: &ChatResponseUpdate) -> AgentResponseUpdate
Wrap a chat update as an agent update.
Trait Implementations§
Source§impl Clone for AgentResponseUpdate
impl Clone for AgentResponseUpdate
Source§fn clone(&self) -> AgentResponseUpdate
fn clone(&self) -> AgentResponseUpdate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more