Class: Vapi::AssemblyAiTranscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/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, 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_propertiesOpenStruct (readonly)



51
52
53
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 51

def additional_properties
  @additional_properties
end

#confidence_thresholdFloat (readonly)



13
14
15
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 13

def confidence_threshold
  @confidence_threshold
end

#disable_partial_transcriptsBoolean (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_apiBoolean (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_thresholdFloat (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_thresholdFloat (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_planVapi::FallbackTranscriberPlan (readonly)



49
50
51
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 49

def fallback_plan
  @fallback_plan
end

#format_turnsBoolean (readonly)



21
22
23
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 21

def format_turns
  @format_turns
end

#languageString (readonly)



10
11
12
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 10

def language
  @language
end

#max_turn_silenceFloat (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_confidentFloat (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_urlString (readonly)



39
40
41
# File 'lib/vapi_server_sdk/types/assembly_ai_transcriber.rb', line 39

def realtime_url
  @realtime_url
end

#word_boostArray<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_timeFloat (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