1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* OpenAI API
*
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.3.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// SemanticVad : Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct SemanticVad {
/// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
#[serde(rename = "type")]
pub r#type: Type,
/// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.
#[serde(rename = "eagerness", skip_serializing_if = "Option::is_none")]
pub eagerness: Option<Eagerness>,
/// Whether or not to automatically generate a response when a VAD stop event occurs.
#[serde(rename = "create_response", skip_serializing_if = "Option::is_none")]
pub create_response: Option<bool>,
/// Whether or not to automatically interrupt any ongoing response with output to the default conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.
#[serde(rename = "interrupt_response", skip_serializing_if = "Option::is_none")]
pub interrupt_response: Option<bool>,
}
impl SemanticVad {
/// Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
pub fn new(r#type: Type) -> SemanticVad {
SemanticVad {
r#type,
eagerness: None,
create_response: None,
interrupt_response: None,
}
}
}
/// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "semantic_vad")]
SemanticVad,
}
impl Default for Type {
fn default() -> Type {
Self::SemanticVad
}
}
/// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Eagerness {
#[serde(rename = "low")]
Low,
#[serde(rename = "medium")]
Medium,
#[serde(rename = "high")]
High,
#[serde(rename = "auto")]
Auto,
}
impl Default for Eagerness {
fn default() -> Eagerness {
Self::Low
}
}
impl std::fmt::Display for SemanticVad {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}