/*
* OpenAI API
*
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.3.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// ResponseSteerPendingEvent : Emitted when accepted steering input remains queued after the target response completes. The server still owns the input. Do not resend it. The successor's `response.created` event is the commit point. When `reason` is `waiting_for_required_input`, this event follows `response.completed` while the response waits for the tool results or approval decisions identified by `required_input`. Copy those stubs, fill their result fields using the ordinary `response.create` input schemas, and submit one continuation per parent with the same `previous_response_id` and WebSocket lane. Use saved results without rerunning tools. The queued steering input is prepended in submission order to the continuation's input. That explicit request retains its own settings. This notification is emitted at most once per steering submission. Multiple submissions for the same parent can report the same required inputs; they do not each require a separate continuation.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseSteerPendingEvent {
/// The event discriminator. Always `response.steer.pending`.
#[serde(rename = "type")]
pub r#type: Type,
/// The sequence number for this event.
#[serde(rename = "sequence_number")]
pub sequence_number: i32,
#[serde(rename = "steer")]
pub steer: Box<models::ResponseSteerPendingEventSteer>,
#[serde(rename = "reason")]
pub reason: Box<models::ResponseSteerPendingReason>,
/// Input stubs identifying outstanding client-owned tool results or approval decisions. Each stub contains identifying fields only; the client supplies the result before including it in `response.create`.
#[serde(rename = "required_input")]
pub required_input: Vec<models::ResponseSteerRequiredInput>,
/// The WebSocket lane that emitted this event. This field is present when the target response's `response.create` event supplied a `stream_id`.
#[serde(rename = "stream_id", skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
}
impl ResponseSteerPendingEvent {
/// Emitted when accepted steering input remains queued after the target response completes. The server still owns the input. Do not resend it. The successor's `response.created` event is the commit point. When `reason` is `waiting_for_required_input`, this event follows `response.completed` while the response waits for the tool results or approval decisions identified by `required_input`. Copy those stubs, fill their result fields using the ordinary `response.create` input schemas, and submit one continuation per parent with the same `previous_response_id` and WebSocket lane. Use saved results without rerunning tools. The queued steering input is prepended in submission order to the continuation's input. That explicit request retains its own settings. This notification is emitted at most once per steering submission. Multiple submissions for the same parent can report the same required inputs; they do not each require a separate continuation.
pub fn new(
r#type: Type,
sequence_number: i32,
steer: models::ResponseSteerPendingEventSteer,
reason: models::ResponseSteerPendingReason,
required_input: Vec<models::ResponseSteerRequiredInput>,
) -> ResponseSteerPendingEvent {
ResponseSteerPendingEvent {
r#type,
sequence_number,
steer: Box::new(steer),
reason: Box::new(reason),
required_input,
stream_id: None,
}
}
}
/// The event discriminator. Always `response.steer.pending`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "response.steer.pending")]
ResponseSteerPending,
}
impl Default for Type {
fn default() -> Type {
Self::ResponseSteerPending
}
}
impl std::fmt::Display for ResponseSteerPendingEvent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}