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, transcription_hint: OMIT, prosody: OMIT, audio_enhancer: 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’.

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

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 55

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



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

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.



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

def audio_enhancer
  @audio_enhancer
end

#languageVapi::GladiaTranscriberLanguage (readonly)

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

Returns:



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

def language
  @language
end

#language_behaviourVapi::GladiaTranscriberLanguageBehaviour (readonly)



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

def language_behaviour
  @language_behaviour
end

#modelVapi::GladiaTranscriberModel (readonly)



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

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.



27
28
29
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 27

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.



24
25
26
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 24

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:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 80

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"]
  transcription_hint = parsed_json["transcriptionHint"]
  prosody = parsed_json["prosody"]
  audio_enhancer = parsed_json["audioEnhancer"]
  new(
    model: model,
    language_behaviour: language_behaviour,
    language: language,
    transcription_hint: transcription_hint,
    prosody: prosody,
    audio_enhancer: audio_enhancer,
    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)


113
114
115
116
117
118
119
120
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 113

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.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.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of GladiaTranscriber to a JSON object

Returns:

  • (String)


103
104
105
# File 'lib/vapi_server_sdk/types/gladia_transcriber.rb', line 103

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