Class: Vapi::DeepgramTranscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/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, language_detection_enabled: OMIT, keywords: OMIT, endpointing: OMIT, additional_properties: nil) ⇒ Vapi::DeepgramTranscriber

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.

  • language_detection_enabled (Boolean) (defaults to: OMIT)

    This enables or disables language detection. If true, swaps transcribers to detected language automatically. Defaults to false.

  • 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.

  • 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



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#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



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

def endpointing
  @endpointing
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.



26
27
28
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 26

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/deepgram_transcriber.rb', line 16

def language
  @language
end

#language_detection_enabledBoolean (readonly)

Returns This enables or disables language detection. If true, swaps transcribers to detected language automatically. Defaults to false.

Returns:

  • (Boolean)

    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

#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/deepgram_transcriber.rb', line 12

def model
  @model
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/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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


124
125
126
# File 'lib/vapi_server_sdk/types/deepgram_transcriber.rb', line 124

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