Class: Vapi::DeepgramTranscriber
- Inherits:
-
Object
- Object
- Vapi::DeepgramTranscriber
- Defined in:
- lib/vapi_server_sdk/types/deepgram_transcriber.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#code_switching_enabled ⇒ Boolean
readonly
This automatically switches the transcriber’s language when the customer’s language changes.
-
#endpointing ⇒ Float
readonly
This is the timeout after which Deepgram will send transcription on user silence.
-
#keywords ⇒ Array<String>
readonly
These keywords are passed to the transcription model to help it pick up use-case specific words.
-
#language ⇒ Vapi::DeepgramTranscriberLanguage
readonly
This is the language that will be set for the transcription.
-
#model ⇒ Vapi::DeepgramTranscriberModel
readonly
This is the Deepgram model that will be used.
-
#smart_format ⇒ Boolean
readonly
This will be use smart format option provided by Deepgram.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::DeepgramTranscriber
Deserialize a JSON object to an instance of DeepgramTranscriber.
-
.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(model: OMIT, language: OMIT, smart_format: OMIT, code_switching_enabled: OMIT, keywords: OMIT, endpointing: OMIT, additional_properties: nil) ⇒ Vapi::DeepgramTranscriber constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of DeepgramTranscriber to a JSON object.
Constructor Details
#initialize(model: OMIT, language: OMIT, smart_format: OMIT, code_switching_enabled: OMIT, keywords: OMIT, endpointing: OMIT, additional_properties: nil) ⇒ Vapi::DeepgramTranscriber
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 134 def initialize(model: OMIT, language: OMIT, smart_format: OMIT, code_switching_enabled: OMIT, keywords: OMIT, endpointing: OMIT, additional_properties: nil) @model = model if model != OMIT @language = language if language != OMIT @smart_format = smart_format if smart_format != OMIT @code_switching_enabled = code_switching_enabled if code_switching_enabled != OMIT @keywords = keywords if keywords != OMIT @endpointing = endpointing if endpointing != OMIT @additional_properties = additional_properties @_field_set = { "model": model, "language": language, "smartFormat": smart_format, "codeSwitchingEnabled": code_switching_enabled, "keywords": keywords, "endpointing": endpointing }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
71 72 73 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 71 def additional_properties @additional_properties end |
#code_switching_enabled ⇒ Boolean (readonly)
Returns This automatically switches the transcriber’s language when the customer’s language changes. Defaults to false. Usage:
-
If your customers switch languages mid-call, you can set this to true.
Note:
-
To detect language changes, Vapi uses a custom trained model. Languages
supported (X = limited support):
-
Arabic
-
Bengali
-
Cantonese
-
Chinese
-
Chinese Simplified (X)
-
Chinese Traditional (X)
-
English
-
Farsi (X)
-
French
-
German
-
Haitian Creole (X)
-
Hindi
-
Italian
-
Japanese
-
Korean
-
Portuguese
-
Russian
-
Spanish
-
Thai
-
Urdu
-
Vietnamese
-
To receive
language-change-detectedwebhook events, add it to
assistant.serverMessages. @default false.
51 52 53 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 51 def code_switching_enabled @code_switching_enabled end |
#endpointing ⇒ Float (readonly)
Returns This is the timeout after which Deepgram will send transcription on user silence. You can read in-depth documentation here: developers.deepgram.com/docs/endpointing. Here are the most important bits:
-
Defaults to 10. This is recommended for most use cases to optimize for
latency.
-
10 can cause some missing transcriptions since because of the shorter context.
This mostly happens for one-word utterances. For those uses cases, it’s recommended to try 300. It will add a bit of latency but the quality and reliability of the experience will be better.
-
If neither 10 nor 300 work, contact [email protected] and we’ll find another
solution. @default 10.
69 70 71 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 69 def endpointing @endpointing end |
#keywords ⇒ Array<String> (readonly)
Returns These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here.
55 56 57 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 55 def keywords @keywords end |
#language ⇒ Vapi::DeepgramTranscriberLanguage (readonly)
Returns This is the language that will be set for the transcription. The list of languages Deepgram supports can be found here: developers.deepgram.com/docs/models-languages-overview.
16 17 18 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 16 def language @language end |
#model ⇒ Vapi::DeepgramTranscriberModel (readonly)
Returns This is the Deepgram model that will be used. A list of models can be found here: developers.deepgram.com/docs/models-languages-overview.
12 13 14 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 12 def model @model end |
#smart_format ⇒ Boolean (readonly)
Returns This will be use smart format option provided by Deepgram. It’s default disabled because it can sometimes format numbers as times but it’s getting better.
19 20 21 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 19 def smart_format @smart_format end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::DeepgramTranscriber
Deserialize a JSON object to an instance of DeepgramTranscriber
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 159 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) model = parsed_json["model"] language = parsed_json["language"] smart_format = parsed_json["smartFormat"] code_switching_enabled = parsed_json["codeSwitchingEnabled"] keywords = parsed_json["keywords"] endpointing = parsed_json["endpointing"] new( model: model, language: language, smart_format: smart_format, code_switching_enabled: code_switching_enabled, keywords: keywords, endpointing: endpointing, 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.
192 193 194 195 196 197 198 199 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 192 def self.validate_raw(obj:) obj.model&.is_a?(Vapi::DeepgramTranscriberModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.language&.is_a?(Vapi::DeepgramTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") obj.smart_format&.is_a?(Boolean) != false || raise("Passed value for field obj.smart_format is not the expected type, validation failed.") obj.code_switching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.code_switching_enabled is not the expected type, validation failed.") obj.keywords&.is_a?(Array) != false || raise("Passed value for field obj.keywords is not the expected type, validation failed.") obj.endpointing&.is_a?(Float) != false || raise("Passed value for field obj.endpointing is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of DeepgramTranscriber to a JSON object
182 183 184 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 182 def to_json(*_args) @_field_set&.to_json end |