openai_realtime/api/
voice.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Debug, Serialize, Deserialize, Default)]
4#[serde(rename_all = "snake_case")]
5pub enum Voice {
6    #[default]
7    Alloy,
8    Ash,
9    Ballad,
10    Coral,
11    Echo,
12    Sage,
13    Shimmer,
14    Verse,
15}
16
17impl From<&str> for Voice {
18    fn from(s: &str) -> Self {
19        serde_json::from_str(format!("\"{}\"", s).as_str()).unwrap()
20    }
21}
22
23impl From<String> for Voice {
24    fn from(s: String) -> Self {
25        serde_json::from_str(format!("\"{}\"", s).as_str()).unwrap()
26    }
27}