rig/client/audio_generation.rs
1#[cfg(feature = "audio")]
2mod audio {
3 use crate::audio_generation::AudioGenerationModel;
4
5 /// A provider client with audio generation capabilities.
6 /// Clone is required for conversions between client types.
7 pub trait AudioGenerationClient {
8 /// The AudioGenerationModel used by the Client
9 type AudioGenerationModel: AudioGenerationModel<Client = Self>;
10
11 /// Create an audio generation model with the given name.
12 ///
13 /// # Example
14 /// ```
15 /// use rig::providers::openai::{Client, self};
16 ///
17 /// // Initialize the OpenAI client
18 /// let openai = Client::new("your-open-ai-api-key");
19 ///
20 /// let tts = openai.audio_generation_model(openai::TTS_1);
21 /// ```
22 fn audio_generation_model(&self, model: impl Into<String>) -> Self::AudioGenerationModel {
23 Self::AudioGenerationModel::make(self, model)
24 }
25 }
26}
27
28#[cfg(feature = "audio")]
29pub use audio::*;