pub struct SpeechRequest {
pub input: String,
pub model: String,
pub voice: String,
pub response_format: Option<AudioFormat>,
pub speed: Option<f32>,
}Expand description
Request for generating speech from text.
Fields§
§input: StringThe text to convert to speech.
model: StringThe model to use (e.g., “tts-1”, “tts-1-hd”).
voice: StringThe voice to use (e.g., “alloy”, “echo”, “fable”).
response_format: Option<AudioFormat>Audio format for the output.
speed: Option<f32>Speed of speech (0.25 to 4.0, default 1.0).
Implementations§
Source§impl SpeechRequest
impl SpeechRequest
Sourcepub fn new(
model: impl Into<String>,
input: impl Into<String>,
voice: impl Into<String>,
) -> Self
pub fn new( model: impl Into<String>, input: impl Into<String>, voice: impl Into<String>, ) -> Self
Create a new speech request.
Sourcepub fn with_format(self, format: AudioFormat) -> Self
pub fn with_format(self, format: AudioFormat) -> Self
Set the audio format.
Sourcepub fn with_speed(self, speed: f32) -> Self
pub fn with_speed(self, speed: f32) -> Self
Set the speech speed (0.25 to 4.0).
Trait Implementations§
Source§impl Clone for SpeechRequest
impl Clone for SpeechRequest
Source§fn clone(&self) -> SpeechRequest
fn clone(&self) -> SpeechRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SpeechRequest
impl RefUnwindSafe for SpeechRequest
impl Send for SpeechRequest
impl Sync for SpeechRequest
impl Unpin for SpeechRequest
impl UnwindSafe for SpeechRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more