async_openai/
audio.rs

1use crate::{config::Config, Client, Speech, Transcriptions, Translations};
2
3/// Turn audio into text or text into audio.
4/// Related guide: [Speech to text](https://platform.openai.com/docs/guides/speech-to-text)
5pub struct Audio<'c, C: Config> {
6    client: &'c Client<C>,
7}
8
9impl<'c, C: Config> Audio<'c, C> {
10    pub fn new(client: &'c Client<C>) -> Self {
11        Self { client }
12    }
13
14    /// APIs in Speech group.
15    pub fn speech(&self) -> Speech<'_, C> {
16        Speech::new(self.client)
17    }
18
19    /// APIs in Transcription group.
20    pub fn transcription(&self) -> Transcriptions<'_, C> {
21        Transcriptions::new(self.client)
22    }
23
24    /// APIs in Translation group.
25    pub fn translation(&self) -> Translations<'_, C> {
26        Translations::new(self.client)
27    }
28}