Class: Vapi::FallbackDeepgramTranscriber

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model: OMIT, language: OMIT, smart_format: OMIT, mip_opt_out: OMIT, numerals: OMIT, confidence_threshold: OMIT, keywords: OMIT, keyterm: OMIT, endpointing: OMIT, additional_properties: nil) ⇒ Vapi::FallbackDeepgramTranscriber

Parameters:

  • model (Vapi::DeepgramTranscriberModel) (defaults to: OMIT)

    This is the Deepgram model that will be used. A list of models can be found here: developers.deepgram.com/docs/models-languages-overview

  • language (Vapi::DeepgramTranscriberLanguage) (defaults to: OMIT)

    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

  • smart_format (Boolean) (defaults to: OMIT)

    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.

  • mip_opt_out (Boolean) (defaults to: OMIT)

    If set to true, this will add mip_opt_out=true as a query parameter of all API requests. See gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out This will only be used if you are using your own Deepgram API key. @default false

  • numerals (Boolean) (defaults to: OMIT)

    If set to true, this will cause deepgram to convert spoken numbers to literal numerals. For example, “my phone number is nine-seven-two…” would become “my phone number is 972…” @default false

  • confidence_threshold (Float) (defaults to: OMIT)

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

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

    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.

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

    Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important keyterms or phrases up to 90%.

  • endpointing (Float) (defaults to: OMIT)

    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.

    solution. @default 10

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 101

def initialize(model: OMIT, language: OMIT, smart_format: OMIT, mip_opt_out: OMIT, numerals: OMIT,
               confidence_threshold: OMIT, keywords: OMIT, keyterm: OMIT, endpointing: OMIT, additional_properties: nil)
  @model = model if model != OMIT
  @language = language if language != OMIT
  @smart_format = smart_format if smart_format != OMIT
  @mip_opt_out = mip_opt_out if mip_opt_out != OMIT
  @numerals = numerals if numerals != OMIT
  @confidence_threshold = confidence_threshold if confidence_threshold != OMIT
  @keywords = keywords if keywords != OMIT
  @keyterm = keyterm if keyterm != OMIT
  @endpointing = endpointing if endpointing != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "model": model,
    "language": language,
    "smartFormat": smart_format,
    "mipOptOut": mip_opt_out,
    "numerals": numerals,
    "confidenceThreshold": confidence_threshold,
    "keywords": keywords,
    "keyterm": keyterm,
    "endpointing": endpointing
  }.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



56
57
58
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 56

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



33
34
35
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 33

def confidence_threshold
  @confidence_threshold
end

#endpointingFloat (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.

solution. @default 10.

Returns:

  • (Float)

    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.

    solution. @default 10



54
55
56
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 54

def endpointing
  @endpointing
end

#keytermArray<String> (readonly)

Returns Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important keyterms or phrases up to 90%.

Returns:

  • (Array<String>)

    Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important keyterms or phrases up to 90%.



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

def keyterm
  @keyterm
end

#keywordsArray<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.

Returns:

  • (Array<String>)

    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.



37
38
39
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 37

def keywords
  @keywords
end

#languageVapi::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.

Returns:



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

def language
  @language
end

#mip_opt_outBoolean (readonly)

Returns If set to true, this will add mip_opt_out=true as a query parameter of all API requests. See gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out This will only be used if you are using your own Deepgram API key. @default false.

Returns:

  • (Boolean)

    If set to true, this will add mip_opt_out=true as a query parameter of all API requests. See gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out This will only be used if you are using your own Deepgram API key. @default false



25
26
27
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 25

def mip_opt_out
  @mip_opt_out
end

#modelVapi::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.

Returns:



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

def model
  @model
end

#numeralsBoolean (readonly)

Returns If set to true, this will cause deepgram to convert spoken numbers to literal numerals. For example, “my phone number is nine-seven-two…” would become “my phone number is 972…” @default false.

Returns:

  • (Boolean)

    If set to true, this will cause deepgram to convert spoken numbers to literal numerals. For example, “my phone number is nine-seven-two…” would become “my phone number is 972…” @default false



30
31
32
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 30

def numerals
  @numerals
end

#smart_formatBoolean (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.

Returns:

  • (Boolean)

    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/fallback_deepgram_transcriber.rb', line 19

def smart_format
  @smart_format
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackDeepgramTranscriber

Deserialize a JSON object to an instance of FallbackDeepgramTranscriber

Parameters:

  • json_object (String)

Returns:



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
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 132

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"]
  mip_opt_out = parsed_json["mipOptOut"]
  numerals = parsed_json["numerals"]
  confidence_threshold = parsed_json["confidenceThreshold"]
  keywords = parsed_json["keywords"]
  keyterm = parsed_json["keyterm"]
  endpointing = parsed_json["endpointing"]
  new(
    model: model,
    language: language,
    smart_format: smart_format,
    mip_opt_out: mip_opt_out,
    numerals: numerals,
    confidence_threshold: confidence_threshold,
    keywords: keywords,
    keyterm: keyterm,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


171
172
173
174
175
176
177
178
179
180
181
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 171

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.mip_opt_out&.is_a?(Boolean) != false || raise("Passed value for field obj.mip_opt_out is not the expected type, validation failed.")
  obj.numerals&.is_a?(Boolean) != false || raise("Passed value for field obj.numerals 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.keywords&.is_a?(Array) != false || raise("Passed value for field obj.keywords is not the expected type, validation failed.")
  obj.keyterm&.is_a?(Array) != false || raise("Passed value for field obj.keyterm 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 FallbackDeepgramTranscriber to a JSON object

Returns:

  • (String)


161
162
163
# File 'lib/vapi_server_sdk/types/fallback_deepgram_transcriber.rb', line 161

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