Class: Vapi::TalkscriberTranscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/talkscriber_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, additional_properties: nil) ⇒ Vapi::TalkscriberTranscriber

Parameters:

  • model (String) (defaults to: OMIT)

    This is the model that will be used for the transcription.

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

    This is the language that will be set for the transcription. The list of languages Whisper supports can be found here: github.com/openai/whisper/blob/main/whisper/tokenizer.py

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
36
# File 'lib/vapi_server_sdk/types/talkscriber_transcriber.rb', line 29

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



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

def additional_properties
  @additional_properties
end

#languageVapi::TalkscriberTranscriberLanguage (readonly)

Returns This is the language that will be set for the transcription. The list of languages Whisper supports can be found here: github.com/openai/whisper/blob/main/whisper/tokenizer.py.

Returns:



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

def language
  @language
end

#modelString (readonly)

Returns This is the model that will be used for the transcription.

Returns:

  • (String)

    This is the model that will be used for the transcription.



10
11
12
# File 'lib/vapi_server_sdk/types/talkscriber_transcriber.rb', line 10

def model
  @model
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TalkscriberTranscriber

Deserialize a JSON object to an instance of TalkscriberTranscriber

Parameters:

  • json_object (String)

Returns:



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vapi_server_sdk/types/talkscriber_transcriber.rb', line 42

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"]
  new(
    model: model,
    language: language,
    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)


67
68
69
70
# File 'lib/vapi_server_sdk/types/talkscriber_transcriber.rb', line 67

def self.validate_raw(obj:)
  obj.model&.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language&.is_a?(Vapi::TalkscriberTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TalkscriberTranscriber to a JSON object

Returns:

  • (String)


57
58
59
# File 'lib/vapi_server_sdk/types/talkscriber_transcriber.rb', line 57

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