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};

/// ResponseSteerFailedEventSteer : The steering submission that could not be committed.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseSteerFailedEventSteer {
    /// The ID assigned to the steering submission, if one was allocated.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The ID of the response that was targeted for steering.
    #[serde(rename = "previous_response_id")]
    pub previous_response_id: String,
    #[serde(rename = "input")]
    pub input: Box<models::ResponseSteerInput>,
}

impl ResponseSteerFailedEventSteer {
    /// The steering submission that could not be committed.
    pub fn new(
        previous_response_id: String,
        input: models::ResponseSteerInput,
    ) -> ResponseSteerFailedEventSteer {
        ResponseSteerFailedEventSteer {
            id: None,
            previous_response_id,
            input: Box::new(input),
        }
    }
}

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