Class: Vapi::FallbackAssemblyAiTranscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(language: OMIT, confidence_threshold: OMIT, enable_universal_streaming_api: OMIT, format_turns: OMIT, end_of_turn_confidence_threshold: OMIT, min_end_of_turn_silence_when_confident: OMIT, word_finalization_max_wait_time: OMIT, max_turn_silence: OMIT, realtime_url: OMIT, word_boost: OMIT, end_utterance_silence_threshold: OMIT, disable_partial_transcripts: OMIT, additional_properties: nil) ⇒ Vapi::FallbackAssemblyAiTranscriber

Parameters:

  • language (String) (defaults to: OMIT)

    This is the language that will be set for the transcription.

  • confidence_threshold (Float) (defaults to: OMIT)

    Transcripts below this confidence threshold will be discarded. @default 0.4

  • enable_universal_streaming_api (Boolean) (defaults to: OMIT)

    Uses Assembly AI’s new Universal Streaming API. See: www.assemblyai.com/docs/speech-to-text/universal-streaming @default false

  • format_turns (Boolean) (defaults to: OMIT)

    This enables formatting of transcripts. Only used when ‘enableUniversalStreamingApi` is true. @default false

  • end_of_turn_confidence_threshold (Float) (defaults to: OMIT)

    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

  • min_end_of_turn_silence_when_confident (Float) (defaults to: OMIT)

    The minimum amount of silence in milliseconds required to detect end of turn when confident. Only used when ‘enableUniversalStreamingApi` is true. @default 160

  • word_finalization_max_wait_time (Float) (defaults to: OMIT)

    The maximum wait time for word finalization. Only used when ‘enableUniversalStreamingApi` is true. @default 160

  • max_turn_silence (Float) (defaults to: OMIT)

    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

  • realtime_url (String) (defaults to: OMIT)

    The WebSocket URL that the transcriber connects to.

  • word_boost (Array<String>) (defaults to: OMIT)

    Add up to 2500 characters of custom vocabulary.

  • end_utterance_silence_threshold (Float) (defaults to: OMIT)

    The duration of the end utterance silence threshold in milliseconds.

  • disable_partial_transcripts (Boolean) (defaults to: OMIT)

    Disable partial transcripts. Set to ‘true` to not receive partial transcripts. Defaults to `false`.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 82

def initialize(language: OMIT, confidence_threshold: OMIT, enable_universal_streaming_api: OMIT,
               format_turns: OMIT, end_of_turn_confidence_threshold: OMIT, min_end_of_turn_silence_when_confident: OMIT, word_finalization_max_wait_time: OMIT, max_turn_silence: OMIT, realtime_url: OMIT, word_boost: OMIT, end_utterance_silence_threshold: OMIT, disable_partial_transcripts: OMIT, additional_properties: nil)
  @language = language if language != OMIT
  @confidence_threshold = confidence_threshold if confidence_threshold != OMIT
  @enable_universal_streaming_api = enable_universal_streaming_api if enable_universal_streaming_api != OMIT
  @format_turns = format_turns if format_turns != OMIT
  @end_of_turn_confidence_threshold = end_of_turn_confidence_threshold if end_of_turn_confidence_threshold != OMIT
  if min_end_of_turn_silence_when_confident != OMIT
    @min_end_of_turn_silence_when_confident = min_end_of_turn_silence_when_confident
  end
  @word_finalization_max_wait_time = word_finalization_max_wait_time if word_finalization_max_wait_time != OMIT
  @max_turn_silence = max_turn_silence if max_turn_silence != OMIT
  @realtime_url = realtime_url if realtime_url != OMIT
  @word_boost = word_boost if word_boost != OMIT
  @end_utterance_silence_threshold = end_utterance_silence_threshold if end_utterance_silence_threshold != OMIT
  @disable_partial_transcripts = disable_partial_transcripts if disable_partial_transcripts != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "language": language,
    "confidenceThreshold": confidence_threshold,
    "enableUniversalStreamingApi": enable_universal_streaming_api,
    "formatTurns": format_turns,
    "endOfTurnConfidenceThreshold": end_of_turn_confidence_threshold,
    "minEndOfTurnSilenceWhenConfident": min_end_of_turn_silence_when_confident,
    "wordFinalizationMaxWaitTime": word_finalization_max_wait_time,
    "maxTurnSilence": max_turn_silence,
    "realtimeUrl": realtime_url,
    "wordBoost": word_boost,
    "endUtteranceSilenceThreshold": end_utterance_silence_threshold,
    "disablePartialTranscripts": disable_partial_transcripts
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



47
48
49
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 47

def additional_properties
  @additional_properties
end

#confidence_thresholdFloat (readonly)

Returns Transcripts below this confidence threshold will be discarded. @default 0.4.

Returns:

  • (Float)

    Transcripts below this confidence threshold will be discarded. @default 0.4



12
13
14
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 12

def confidence_threshold
  @confidence_threshold
end

#disable_partial_transcriptsBoolean (readonly)

Returns Disable partial transcripts. Set to ‘true` to not receive partial transcripts. Defaults to `false`.

Returns:

  • (Boolean)

    Disable partial transcripts. Set to ‘true` to not receive partial transcripts. Defaults to `false`.



45
46
47
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 45

def disable_partial_transcripts
  @disable_partial_transcripts
end

#enable_universal_streaming_apiBoolean (readonly)

Returns Uses Assembly AI’s new Universal Streaming API. See: www.assemblyai.com/docs/speech-to-text/universal-streaming @default false.

Returns:



16
17
18
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 16

def enable_universal_streaming_api
  @enable_universal_streaming_api
end

#end_of_turn_confidence_thresholdFloat (readonly)

Returns 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.

Returns:

  • (Float)

    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



24
25
26
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 24

def end_of_turn_confidence_threshold
  @end_of_turn_confidence_threshold
end

#end_utterance_silence_thresholdFloat (readonly)

Returns The duration of the end utterance silence threshold in milliseconds.

Returns:

  • (Float)

    The duration of the end utterance silence threshold in milliseconds.



42
43
44
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 42

def end_utterance_silence_threshold
  @end_utterance_silence_threshold
end

#format_turnsBoolean (readonly)

Returns This enables formatting of transcripts. Only used when ‘enableUniversalStreamingApi` is true. @default false.

Returns:

  • (Boolean)

    This enables formatting of transcripts. Only used when ‘enableUniversalStreamingApi` is true. @default false



20
21
22
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 20

def format_turns
  @format_turns
end

#languageString (readonly)

Returns This is the language that will be set for the transcription.

Returns:

  • (String)

    This is the language that will be set for the transcription.



9
10
11
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 9

def language
  @language
end

#max_turn_silenceFloat (readonly)

Returns 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.

Returns:

  • (Float)

    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



36
37
38
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 36

def max_turn_silence
  @max_turn_silence
end

#min_end_of_turn_silence_when_confidentFloat (readonly)

Returns The minimum amount of silence in milliseconds required to detect end of turn when confident. Only used when ‘enableUniversalStreamingApi` is true. @default 160.

Returns:

  • (Float)

    The minimum amount of silence in milliseconds required to detect end of turn when confident. Only used when ‘enableUniversalStreamingApi` is true. @default 160



28
29
30
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 28

def min_end_of_turn_silence_when_confident
  @min_end_of_turn_silence_when_confident
end

#realtime_urlString (readonly)

Returns The WebSocket URL that the transcriber connects to.

Returns:

  • (String)

    The WebSocket URL that the transcriber connects to.



38
39
40
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 38

def realtime_url
  @realtime_url
end

#word_boostArray<String> (readonly)

Returns Add up to 2500 characters of custom vocabulary.

Returns:

  • (Array<String>)

    Add up to 2500 characters of custom vocabulary.



40
41
42
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 40

def word_boost
  @word_boost
end

#word_finalization_max_wait_timeFloat (readonly)

Returns The maximum wait time for word finalization. Only used when ‘enableUniversalStreamingApi` is true. @default 160.

Returns:

  • (Float)

    The maximum wait time for word finalization. Only used when ‘enableUniversalStreamingApi` is true. @default 160



32
33
34
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 32

def word_finalization_max_wait_time
  @word_finalization_max_wait_time
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackAssemblyAiTranscriber

Deserialize a JSON object to an instance of FallbackAssemblyAiTranscriber

Parameters:

  • json_object (String)

Returns:



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 121

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  language = parsed_json["language"]
  confidence_threshold = parsed_json["confidenceThreshold"]
  enable_universal_streaming_api = parsed_json["enableUniversalStreamingApi"]
  format_turns = parsed_json["formatTurns"]
  end_of_turn_confidence_threshold = parsed_json["endOfTurnConfidenceThreshold"]
  min_end_of_turn_silence_when_confident = parsed_json["minEndOfTurnSilenceWhenConfident"]
  word_finalization_max_wait_time = parsed_json["wordFinalizationMaxWaitTime"]
  max_turn_silence = parsed_json["maxTurnSilence"]
  realtime_url = parsed_json["realtimeUrl"]
  word_boost = parsed_json["wordBoost"]
  end_utterance_silence_threshold = parsed_json["endUtteranceSilenceThreshold"]
  disable_partial_transcripts = parsed_json["disablePartialTranscripts"]
  new(
    language: language,
    confidence_threshold: confidence_threshold,
    enable_universal_streaming_api: enable_universal_streaming_api,
    format_turns: format_turns,
    end_of_turn_confidence_threshold: end_of_turn_confidence_threshold,
    min_end_of_turn_silence_when_confident: min_end_of_turn_silence_when_confident,
    word_finalization_max_wait_time: word_finalization_max_wait_time,
    max_turn_silence: max_turn_silence,
    realtime_url: realtime_url,
    word_boost: word_boost,
    end_utterance_silence_threshold: end_utterance_silence_threshold,
    disable_partial_transcripts: disable_partial_transcripts,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 166

def self.validate_raw(obj:)
  obj.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
  obj.confidence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.confidence_threshold is not the expected type, validation failed.")
  obj.enable_universal_streaming_api&.is_a?(Boolean) != false || raise("Passed value for field obj.enable_universal_streaming_api is not the expected type, validation failed.")
  obj.format_turns&.is_a?(Boolean) != false || raise("Passed value for field obj.format_turns is not the expected type, validation failed.")
  obj.end_of_turn_confidence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.end_of_turn_confidence_threshold is not the expected type, validation failed.")
  obj.min_end_of_turn_silence_when_confident&.is_a?(Float) != false || raise("Passed value for field obj.min_end_of_turn_silence_when_confident is not the expected type, validation failed.")
  obj.word_finalization_max_wait_time&.is_a?(Float) != false || raise("Passed value for field obj.word_finalization_max_wait_time is not the expected type, validation failed.")
  obj.max_turn_silence&.is_a?(Float) != false || raise("Passed value for field obj.max_turn_silence is not the expected type, validation failed.")
  obj.realtime_url&.is_a?(String) != false || raise("Passed value for field obj.realtime_url is not the expected type, validation failed.")
  obj.word_boost&.is_a?(Array) != false || raise("Passed value for field obj.word_boost is not the expected type, validation failed.")
  obj.end_utterance_silence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.end_utterance_silence_threshold is not the expected type, validation failed.")
  obj.disable_partial_transcripts&.is_a?(Boolean) != false || raise("Passed value for field obj.disable_partial_transcripts is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FallbackAssemblyAiTranscriber to a JSON object

Returns:

  • (String)


156
157
158
# File 'lib/vapi_server_sdk/types/fallback_assembly_ai_transcriber.rb', line 156

def to_json(*_args)
  @_field_set&.to_json
end