openai-client-base 0.16.0

Auto-generated Rust client for the OpenAI API
/*
 * 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};

/// ResponseSteerEvent : Queues user input to steer a response on this WebSocket connection. Input can contain text, images, and files. Steering is supported only for single-agent responses on models and execution modes that support steering. Responses bound to a conversation or using automatic compaction do not support steering.  A `response.steer.accepted` event acknowledges that the server owns the queued input, not that it has been applied. The successor's `response.created` event is the commit point. Input that cannot be committed is returned in `response.steer.failed`.  Steering may cause the active response to finish at a safe output boundary with `response.incomplete` and `incomplete_details.reason` set to `steered`, followed automatically by a successor `response.created`. Normal completion can also be followed by an automatic successor. Automatic successors inherit the previous response's settings and continue from it with the queued input.  If the response stops for client-owned tool output or approval, accepted steering input remains queued and `response.steer.pending` is emitted after `response.completed`. Fill the `required_input` stubs from that event with saved tool results or approval decisions, and send one explicit `response.create` per parent with the same `previous_response_id` and WebSocket lane. Do not rerun tools or resend accepted steering input. The queued input is prepended in submission order to that request's input, and the explicit request retains its own settings.  This event accepts only `type`, `previous_response_id`, and `input`. Do not send `stream_id`; the target response determines the WebSocket lane.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseSteerEvent {
    /// The event discriminator. Always `response.steer`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The ID of the response to steer on this WebSocket connection.
    #[serde(rename = "previous_response_id")]
    pub previous_response_id: String,
    #[serde(rename = "input")]
    pub input: Box<models::ResponseSteerInput>,
}

impl ResponseSteerEvent {
    /// Queues user input to steer a response on this WebSocket connection. Input can contain text, images, and files. Steering is supported only for single-agent responses on models and execution modes that support steering. Responses bound to a conversation or using automatic compaction do not support steering.  A `response.steer.accepted` event acknowledges that the server owns the queued input, not that it has been applied. The successor's `response.created` event is the commit point. Input that cannot be committed is returned in `response.steer.failed`.  Steering may cause the active response to finish at a safe output boundary with `response.incomplete` and `incomplete_details.reason` set to `steered`, followed automatically by a successor `response.created`. Normal completion can also be followed by an automatic successor. Automatic successors inherit the previous response's settings and continue from it with the queued input.  If the response stops for client-owned tool output or approval, accepted steering input remains queued and `response.steer.pending` is emitted after `response.completed`. Fill the `required_input` stubs from that event with saved tool results or approval decisions, and send one explicit `response.create` per parent with the same `previous_response_id` and WebSocket lane. Do not rerun tools or resend accepted steering input. The queued input is prepended in submission order to that request's input, and the explicit request retains its own settings.  This event accepts only `type`, `previous_response_id`, and `input`. Do not send `stream_id`; the target response determines the WebSocket lane.
    pub fn new(
        r#type: Type,
        previous_response_id: String,
        input: models::ResponseSteerInput,
    ) -> ResponseSteerEvent {
        ResponseSteerEvent {
            r#type,
            previous_response_id,
            input: Box::new(input),
        }
    }
}
/// The event discriminator. Always `response.steer`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "response.steer")]
    ResponseSteer,
}

impl Default for Type {
    fn default() -> Type {
        Self::ResponseSteer
    }
}

impl std::fmt::Display for ResponseSteerEvent {
    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),
        }
    }
}