Class: Vapi::GladiaTranscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/gladia_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_behaviour: OMIT, language: OMIT, languages: OMIT, transcription_hint: OMIT, prosody: OMIT, audio_enhancer: OMIT, confidence_threshold: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::GladiaTranscriber

Parameters:

  • model (Vapi::GladiaTranscriberModel) (defaults to: OMIT)
  • language_behaviour (Vapi::GladiaTranscriberLanguageBehaviour) (defaults to: OMIT)
  • language (Vapi::GladiaTranscriberLanguage) (defaults to: OMIT)

    Defines the language to use for the transcription. Required when languageBehaviour is ‘manual’.

  • languages (Vapi::GladiaTranscriberLanguages) (defaults to: OMIT)

    Defines the languages to use for the transcription. Required when languageBehaviour is ‘manual’.

  • transcription_hint (String) (defaults to: OMIT)

    Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored. ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit.

  • prosody (Boolean) (defaults to: OMIT)

    If prosody is true, you will get a transcription that can contain prosodies i.e. (laugh) (giggles) (malefic laugh) (toss) (music)… Default value is false.

  • audio_enhancer (Boolean) (defaults to: OMIT)

    If true, audio will be pre-processed to improve accuracy but latency will increase. Default value is false.

  • confidence_threshold (Float) (defaults to: OMIT)

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

  • fallback_plan (Vapi::FallbackTranscriberPlan) (defaults to: OMIT)

    This is the plan for voice provider fallbacks in the event that the primary voice provider fails.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 72

def initialize(model: OMIT, language_behaviour: OMIT, language: OMIT, languages: OMIT, transcription_hint: OMIT,
               prosody: OMIT, audio_enhancer: OMIT, confidence_threshold: OMIT, fallback_plan: OMIT, additional_properties: nil)
  @model = model if model != OMIT
  @language_behaviour = language_behaviour if language_behaviour != OMIT
  @language = language if language != OMIT
  @languages = languages if languages != OMIT
  @transcription_hint = transcription_hint if transcription_hint != OMIT
  @prosody = prosody if prosody != OMIT
  @audio_enhancer = audio_enhancer if audio_enhancer != OMIT
  @confidence_threshold = confidence_threshold if confidence_threshold != OMIT
  @fallback_plan = fallback_plan if fallback_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "model": model,
    "languageBehaviour": language_behaviour,
    "language": language,
    "languages": languages,
    "transcriptionHint": transcription_hint,
    "prosody": prosody,
    "audioEnhancer": audio_enhancer,
    "confidenceThreshold": confidence_threshold,
    "fallbackPlan": fallback_plan
  }.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



43
44
45
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 43

def additional_properties
  @additional_properties
end

#audio_enhancerBoolean (readonly)

Returns If true, audio will be pre-processed to improve accuracy but latency will increase. Default value is false.

Returns:

  • (Boolean)

    If true, audio will be pre-processed to improve accuracy but latency will increase. Default value is false.



35
36
37
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 35

def audio_enhancer
  @audio_enhancer
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



38
39
40
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 38

def confidence_threshold
  @confidence_threshold
end

#fallback_planVapi::FallbackTranscriberPlan (readonly)

Returns This is the plan for voice provider fallbacks in the event that the primary voice provider fails.

Returns:



41
42
43
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 41

def fallback_plan
  @fallback_plan
end

#languageVapi::GladiaTranscriberLanguage (readonly)

Returns Defines the language to use for the transcription. Required when languageBehaviour is ‘manual’.

Returns:



19
20
21
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 19

def language
  @language
end

#language_behaviourVapi::GladiaTranscriberLanguageBehaviour (readonly)



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

def language_behaviour
  @language_behaviour
end

#languagesVapi::GladiaTranscriberLanguages (readonly)

Returns Defines the languages to use for the transcription. Required when languageBehaviour is ‘manual’.

Returns:



22
23
24
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 22

def languages
  @languages
end

#modelVapi::GladiaTranscriberModel (readonly)



14
15
16
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 14

def model
  @model
end

#prosodyBoolean (readonly)

Returns If prosody is true, you will get a transcription that can contain prosodies i.e. (laugh) (giggles) (malefic laugh) (toss) (music)… Default value is false.

Returns:

  • (Boolean)

    If prosody is true, you will get a transcription that can contain prosodies i.e. (laugh) (giggles) (malefic laugh) (toss) (music)… Default value is false.



32
33
34
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 32

def prosody
  @prosody
end

#transcription_hintString (readonly)

Returns Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored. ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit.

Returns:

  • (String)

    Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored. ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit.



29
30
31
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 29

def transcription_hint
  @transcription_hint
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::GladiaTranscriber

Deserialize a JSON object to an instance of GladiaTranscriber

Parameters:

  • json_object (String)

Returns:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 103

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_behaviour = parsed_json["languageBehaviour"]
  language = parsed_json["language"]
  languages = parsed_json["languages"]
  transcription_hint = parsed_json["transcriptionHint"]
  prosody = parsed_json["prosody"]
  audio_enhancer = parsed_json["audioEnhancer"]
  confidence_threshold = parsed_json["confidenceThreshold"]
  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(
    model: model,
    language_behaviour: language_behaviour,
    language: language,
    languages: languages,
    transcription_hint: transcription_hint,
    prosody: prosody,
    audio_enhancer: audio_enhancer,
    confidence_threshold: confidence_threshold,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


147
148
149
150
151
152
153
154
155
156
157
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 147

def self.validate_raw(obj:)
  obj.model&.is_a?(Vapi::GladiaTranscriberModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language_behaviour&.is_a?(Vapi::GladiaTranscriberLanguageBehaviour) != false || raise("Passed value for field obj.language_behaviour is not the expected type, validation failed.")
  obj.language&.is_a?(Vapi::GladiaTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
  obj.languages&.is_a?(Vapi::GladiaTranscriberLanguages) != false || raise("Passed value for field obj.languages is not the expected type, validation failed.")
  obj.transcription_hint&.is_a?(String) != false || raise("Passed value for field obj.transcription_hint is not the expected type, validation failed.")
  obj.prosody&.is_a?(Boolean) != false || raise("Passed value for field obj.prosody is not the expected type, validation failed.")
  obj.audio_enhancer&.is_a?(Boolean) != false || raise("Passed value for field obj.audio_enhancer 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.fallback_plan.nil? || Vapi::FallbackTranscriberPlan.validate_raw(obj: obj.fallback_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of GladiaTranscriber to a JSON object

Returns:

  • (String)


137
138
139
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 137

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