vapi_client/models/
assembly_ai_transcriber.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AssemblyAiTranscriber {
16    /// This is the transcription provider that will be used.
17    #[serde(rename = "provider")]
18    pub provider: ProviderTrue,
19    /// This is the language that will be set for the transcription.
20    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
21    pub language: Option<LanguageTrue>,
22    /// Transcripts below this confidence threshold will be discarded.  @default 0.4
23    #[serde(
24        rename = "confidenceThreshold",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub confidence_threshold: Option<f64>,
28    /// Uses Assembly AI's new Universal Streaming API. See: https://www.assemblyai.com/docs/speech-to-text/universal-streaming  @default false
29    #[serde(
30        rename = "enableUniversalStreamingApi",
31        skip_serializing_if = "Option::is_none"
32    )]
33    pub enable_universal_streaming_api: Option<bool>,
34    /// This enables formatting of transcripts. Only used when `enableUniversalStreamingApi` is true.  @default false
35    #[serde(rename = "formatTurns", skip_serializing_if = "Option::is_none")]
36    pub format_turns: Option<bool>,
37    /// The confidence threshold to use when determining if the end of a turn has been reached. Only used when `enableUniversalStreamingApi` is true.  @default 0.7
38    #[serde(
39        rename = "endOfTurnConfidenceThreshold",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub end_of_turn_confidence_threshold: Option<f64>,
43    /// The minimum amount of silence in milliseconds required to detect end of turn when confident. Only used when `enableUniversalStreamingApi` is true.  @default 160
44    #[serde(
45        rename = "minEndOfTurnSilenceWhenConfident",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub min_end_of_turn_silence_when_confident: Option<f64>,
49    /// The maximum wait time for word finalization. Only used when `enableUniversalStreamingApi` is true.  @default 160
50    #[serde(
51        rename = "wordFinalizationMaxWaitTime",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub word_finalization_max_wait_time: Option<f64>,
55    /// The maximum amount of silence in milliseconds allowed in a turn before end of turn is triggered. Only used when `enableUniversalStreamingApi` is true.  @default 400
56    #[serde(rename = "maxTurnSilence", skip_serializing_if = "Option::is_none")]
57    pub max_turn_silence: Option<f64>,
58    /// The WebSocket URL that the transcriber connects to.
59    #[serde(rename = "realtimeUrl", skip_serializing_if = "Option::is_none")]
60    pub realtime_url: Option<String>,
61    /// Add up to 2500 characters of custom vocabulary.
62    #[serde(rename = "wordBoost", skip_serializing_if = "Option::is_none")]
63    pub word_boost: Option<Vec<String>>,
64    /// The duration of the end utterance silence threshold in milliseconds.
65    #[serde(
66        rename = "endUtteranceSilenceThreshold",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub end_utterance_silence_threshold: Option<f64>,
70    /// Disable partial transcripts. Set to `true` to not receive partial transcripts. Defaults to `false`.
71    #[serde(
72        rename = "disablePartialTranscripts",
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub disable_partial_transcripts: Option<bool>,
76    /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
77    #[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
78    pub fallback_plan: Option<models::FallbackTranscriberPlan>,
79}
80
81impl AssemblyAiTranscriber {
82    pub fn new(provider: ProviderTrue) -> AssemblyAiTranscriber {
83        AssemblyAiTranscriber {
84            provider,
85            language: None,
86            confidence_threshold: None,
87            enable_universal_streaming_api: None,
88            format_turns: None,
89            end_of_turn_confidence_threshold: None,
90            min_end_of_turn_silence_when_confident: None,
91            word_finalization_max_wait_time: None,
92            max_turn_silence: None,
93            realtime_url: None,
94            word_boost: None,
95            end_utterance_silence_threshold: None,
96            disable_partial_transcripts: None,
97            fallback_plan: None,
98        }
99    }
100}
101/// This is the transcription provider that will be used.
102#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
103pub enum ProviderTrue {
104    #[serde(rename = "assembly-ai")]
105    AssemblyAi,
106}
107
108impl Default for ProviderTrue {
109    fn default() -> ProviderTrue {
110        Self::AssemblyAi
111    }
112}
113/// This is the language that will be set for the transcription.
114#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
115pub enum LanguageTrue {
116    #[serde(rename = "en")]
117    En,
118}
119
120impl Default for LanguageTrue {
121    fn default() -> LanguageTrue {
122        Self::En
123    }
124}