vapi_client/models/
custom_transcriber.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct CustomTranscriber {
19    /// This is the transcription provider that will be used. Use `custom-transcriber` for providers that are not natively supported.
20    #[serde(rename = "provider")]
21    pub provider: Provider,
22    /// This is where the transcription request will be sent.  Usage: 1. Vapi will initiate a websocket connection with `server.url`.  2. Vapi will send an initial text frame with the sample rate. Format: ```     {       \"type\": \"start\",       \"encoding\": \"linear16\", // 16-bit raw PCM format       \"container\": \"raw\",       \"sampleRate\": {{sampleRate}},       \"channels\": 2 // customer is channel 0, assistant is channel 1     } ```  3. Vapi will send the audio data in 16-bit raw PCM format as binary frames.  4. You can read the messages something like this: ``` ws.on('message', (data, isBinary) => {   if (isBinary) {     pcmBuffer = Buffer.concat([pcmBuffer, data]);     console.log(`Received PCM data, buffer size: ${pcmBuffer.length}`);   } else {     console.log('Received message:', JSON.parse(data.toString()));   } }); ```  5. You will respond with transcriptions as you have them. Format: ```  {     \"type\": \"transcriber-response\",     \"transcription\": \"Hello, world!\",     \"channel\": \"customer\" | \"assistant\"  } ```
23    #[serde(rename = "server")]
24    pub server: models::Server,
25}
26
27impl CustomTranscriber {
28    pub fn new(provider: Provider, server: models::Server) -> CustomTranscriber {
29        CustomTranscriber { provider, server }
30    }
31}
32/// This is the transcription provider that will be used. Use `custom-transcriber` for providers that are not natively supported.
33#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
34pub enum Provider {
35    #[serde(rename = "custom-transcriber")]
36    CustomTranscriber,
37}
38
39impl Default for Provider {
40    fn default() -> Provider {
41        Self::CustomTranscriber
42    }
43}