use serde::Serialize;
use super::enums::{AudioResponseFormat, AudioVoice, SpeechResponseFormat};
#[derive(Debug)]
pub struct TranscriptionParams {
pub file: Vec<u8>,
pub filename: String,
pub model: String,
pub language: Option<String>,
pub prompt: Option<String>,
pub response_format: Option<AudioResponseFormat>,
pub temperature: Option<f64>,
}
impl TranscriptionParams {
pub fn new(file: Vec<u8>, filename: impl Into<String>, model: impl Into<String>) -> Self {
Self {
file,
filename: filename.into(),
model: model.into(),
language: None,
prompt: None,
response_format: None,
temperature: None,
}
}
}
#[derive(Debug)]
pub struct TranslationParams {
pub file: Vec<u8>,
pub filename: String,
pub model: String,
pub prompt: Option<String>,
pub response_format: Option<AudioResponseFormat>,
pub temperature: Option<f64>,
}
impl TranslationParams {
pub fn new(file: Vec<u8>, filename: impl Into<String>, model: impl Into<String>) -> Self {
Self {
file,
filename: filename.into(),
model: model.into(),
prompt: None,
response_format: None,
temperature: None,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct SpeechRequest {
pub input: String,
pub model: String,
pub voice: AudioVoice,
#[serde(skip_serializing_if = "Option::is_none")]
pub response_format: Option<SpeechResponseFormat>,
#[serde(skip_serializing_if = "Option::is_none")]
pub speed: Option<f64>,
}
impl SpeechRequest {
pub fn new(input: impl Into<String>, model: impl Into<String>, voice: AudioVoice) -> Self {
Self {
input: input.into(),
model: model.into(),
voice,
response_format: None,
speed: None,
}
}
}