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.
-
#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.
-
#language_detection_enabled ⇒ Boolean
readonly
This enables or disables language detection.
-
#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, language_detection_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, language_detection_enabled: OMIT, keywords: OMIT, endpointing: OMIT, additional_properties: nil) ⇒ Vapi::DeepgramTranscriber
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 76 def initialize(model: OMIT, language: OMIT, smart_format: OMIT, language_detection_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 @language_detection_enabled = language_detection_enabled if language_detection_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, "languageDetectionEnabled": language_detection_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.
42 43 44 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 42 def additional_properties @additional_properties 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.
40 41 42 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 40 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.
26 27 28 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 26 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 |
#language_detection_enabled ⇒ Boolean (readonly)
Returns This enables or disables language detection. If true, swaps transcribers to detected language automatically. Defaults to false.
22 23 24 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 22 def language_detection_enabled @language_detection_enabled 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
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 101 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"] language_detection_enabled = parsed_json["languageDetectionEnabled"] keywords = parsed_json["keywords"] endpointing = parsed_json["endpointing"] new( model: model, language: language, smart_format: smart_format, language_detection_enabled: language_detection_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.
134 135 136 137 138 139 140 141 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 134 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.language_detection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.language_detection_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
124 125 126 |
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 124 def to_json(*_args) @_field_set&.to_json end |