Class: Vapi::AssemblyAiTranscriber
- Inherits:
-
Object
- Object
- Vapi::AssemblyAiTranscriber
- Defined in:
- lib/vapi_server_sdk/types/assembly_ai_transcriber.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#confidence_threshold ⇒ Float
readonly
Transcripts below this confidence threshold will be discarded.
-
#disable_partial_transcripts ⇒ Boolean
readonly
Disable partial transcripts.
-
#enable_universal_streaming_api ⇒ Boolean
readonly
Uses Assembly AI’s new Universal Streaming API.
-
#end_of_turn_confidence_threshold ⇒ Float
readonly
The confidence threshold to use when determining if the end of a turn has been reached.
-
#end_utterance_silence_threshold ⇒ Float
readonly
The duration of the end utterance silence threshold in milliseconds.
-
#fallback_plan ⇒ Vapi::FallbackTranscriberPlan
readonly
This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
-
#format_turns ⇒ Boolean
readonly
This enables formatting of transcripts.
-
#language ⇒ String
readonly
This is the language that will be set for the transcription.
-
#max_turn_silence ⇒ Float
readonly
The maximum amount of silence in milliseconds allowed in a turn before end of turn is triggered.
-
#min_end_of_turn_silence_when_confident ⇒ Float
readonly
The minimum amount of silence in milliseconds required to detect end of turn when confident.
-
#realtime_url ⇒ String
readonly
The WebSocket URL that the transcriber connects to.
-
#word_boost ⇒ Array<String>
readonly
Add up to 2500 characters of custom vocabulary.
-
#word_finalization_max_wait_time ⇒ Float
readonly
The maximum wait time for word finalization.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::AssemblyAiTranscriber
Deserialize a JSON object to an instance of AssemblyAiTranscriber.
-
.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.
Instance Method Summary collapse
- #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, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::AssemblyAiTranscriber constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AssemblyAiTranscriber to a JSON object.
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, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::AssemblyAiTranscriber
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 116 117 118 119 120 121 122 123 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 88 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, fallback_plan: 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 @fallback_plan = fallback_plan if fallback_plan != 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, "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
51 52 53 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 51 def additional_properties @additional_properties end |
#confidence_threshold ⇒ Float (readonly)
13 14 15 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 13 def confidence_threshold @confidence_threshold end |
#disable_partial_transcripts ⇒ Boolean (readonly)
46 47 48 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 46 def disable_partial_transcripts @disable_partial_transcripts end |
#enable_universal_streaming_api ⇒ Boolean (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 17 def enable_universal_streaming_api @enable_universal_streaming_api end |
#end_of_turn_confidence_threshold ⇒ Float (readonly)
25 26 27 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 25 def end_of_turn_confidence_threshold @end_of_turn_confidence_threshold end |
#end_utterance_silence_threshold ⇒ Float (readonly)
43 44 45 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 43 def end_utterance_silence_threshold @end_utterance_silence_threshold end |
#fallback_plan ⇒ Vapi::FallbackTranscriberPlan (readonly)
49 50 51 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 49 def fallback_plan @fallback_plan end |
#format_turns ⇒ Boolean (readonly)
21 22 23 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 21 def format_turns @format_turns end |
#language ⇒ String (readonly)
10 11 12 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 10 def language @language end |
#max_turn_silence ⇒ Float (readonly)
37 38 39 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 37 def max_turn_silence @max_turn_silence end |
#min_end_of_turn_silence_when_confident ⇒ Float (readonly)
29 30 31 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 29 def min_end_of_turn_silence_when_confident @min_end_of_turn_silence_when_confident end |
#realtime_url ⇒ String (readonly)
39 40 41 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 39 def realtime_url @realtime_url end |
#word_boost ⇒ Array<String> (readonly)
41 42 43 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 41 def word_boost @word_boost end |
#word_finalization_max_wait_time ⇒ Float (readonly)
33 34 35 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 33 def word_finalization_max_wait_time @word_finalization_max_wait_time end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::AssemblyAiTranscriber
Deserialize a JSON object to an instance of AssemblyAiTranscriber
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 129 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"] if parsed_json["fallbackPlan"].nil? fallback_plan = nil else fallback_plan = parsed_json["fallbackPlan"].to_json fallback_plan = Vapi::FallbackTranscriberPlan.from_json(json_object: fallback_plan) end 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, fallback_plan: fallback_plan, 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.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 181 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.") obj.fallback_plan.nil? || Vapi::FallbackTranscriberPlan.validate_raw(obj: obj.fallback_plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AssemblyAiTranscriber to a JSON object
171 172 173 |
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 171 def to_json(*_args) @_field_set&.to_json end |