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

/// PromptCacheBreakpointParam : Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct PromptCacheBreakpointParam {
    /// The breakpoint mode. Always `explicit`.
    #[serde(rename = "mode")]
    pub mode: Mode,
}

impl PromptCacheBreakpointParam {
    /// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.
    pub fn new(mode: Mode) -> PromptCacheBreakpointParam {
        PromptCacheBreakpointParam { mode }
    }
}
/// The breakpoint mode. Always `explicit`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Mode {
    #[serde(rename = "explicit")]
    Explicit,
}

impl Default for Mode {
    fn default() -> Mode {
        Self::Explicit
    }
}

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