pub struct SpeechBuilder { /* private fields */ }Expand description
Builder for text-to-speech requests.
Implementations§
Source§impl SpeechBuilder
impl SpeechBuilder
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 builder with the required model, input text, and voice.
Sourcepub fn instructions(self, instructions: impl Into<String>) -> Self
pub fn instructions(self, instructions: impl Into<String>) -> Self
Add additional voice instructions (ignored for legacy TTS models).
Sourcepub fn response_format(self, format: SpeechResponseFormat) -> Self
pub fn response_format(self, format: SpeechResponseFormat) -> Self
Choose the audio response format (default is mp3).
Sourcepub fn speed(self, speed: f64) -> Self
pub fn speed(self, speed: f64) -> Self
Set the playback speed. Must be between 0.25 and 4.0 inclusive.
Sourcepub fn stream_format(self, format: SpeechStreamFormat) -> Self
pub fn stream_format(self, format: SpeechStreamFormat) -> Self
Configure streaming output. Unsupported for some legacy models.
Sourcepub fn response_format_ref(&self) -> Option<SpeechResponseFormat>
pub fn response_format_ref(&self) -> Option<SpeechResponseFormat>
Access the configured response format, if any.
Sourcepub fn stream_format_ref(&self) -> Option<SpeechStreamFormat>
pub fn stream_format_ref(&self) -> Option<SpeechStreamFormat>
Access the configured stream format, if any.
Trait Implementations§
Source§impl Builder<CreateSpeechRequest> for SpeechBuilder
impl Builder<CreateSpeechRequest> for SpeechBuilder
Source§fn build(self) -> Result<CreateSpeechRequest>
fn build(self) -> Result<CreateSpeechRequest>
Build the final request type.
Source§impl Clone for SpeechBuilder
impl Clone for SpeechBuilder
Source§fn clone(&self) -> SpeechBuilder
fn clone(&self) -> SpeechBuilder
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 SpeechBuilder
impl RefUnwindSafe for SpeechBuilder
impl Send for SpeechBuilder
impl Sync for SpeechBuilder
impl Unpin for SpeechBuilder
impl UnwindSafe for SpeechBuilder
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