async_openai/
audio.rs

1use crate::{config::Config, Client, RequestOptions, 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    pub(crate) request_options: RequestOptions,
8}
9
10impl<'c, C: Config> Audio<'c, C> {
11    pub fn new(client: &'c Client<C>) -> Self {
12        Self {
13            client,
14            request_options: RequestOptions::new(),
15        }
16    }
17
18    /// APIs in Speech group.
19    pub fn speech(&self) -> Speech<'_, C> {
20        Speech::new(self.client)
21    }
22
23    /// APIs in Transcription group.
24    pub fn transcription(&self) -> Transcriptions<'_, C> {
25        Transcriptions::new(self.client)
26    }
27
28    /// APIs in Translation group.
29    pub fn translation(&self) -> Translations<'_, C> {
30        Translations::new(self.client)
31    }
32}