Class: Vapi::OpenAiTranscriber

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, language: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::OpenAiTranscriber

Parameters:

  • model (Vapi::OpenAiTranscriberModel)

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

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

    This is the language that will be set for the transcription.

  • 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



32
33
34
35
36
37
38
39
40
# File 'lib/vapi_server_sdk/types/open_ai_transcriber.rb', line 32

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



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

def additional_properties
  @additional_properties
end

#fallback_planVapi::FallbackTranscriberPlan (readonly)

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

Returns:



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

def fallback_plan
  @fallback_plan
end

#languageVapi::OpenAiTranscriberLanguage (readonly)

Returns This is the language that will be set for the transcription.

Returns:



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

def language
  @language
end

#modelVapi::OpenAiTranscriberModel (readonly)

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

Returns:



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

def model
  @model
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::OpenAiTranscriber

Deserialize a JSON object to an instance of OpenAiTranscriber

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vapi_server_sdk/types/open_ai_transcriber.rb', line 46

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


78
79
80
81
82
# File 'lib/vapi_server_sdk/types/open_ai_transcriber.rb', line 78

def self.validate_raw(obj:)
  obj.model.is_a?(Vapi::OpenAiTranscriberModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language&.is_a?(Vapi::OpenAiTranscriberLanguage) != false || raise("Passed value for field obj.language 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 OpenAiTranscriber to a JSON object

Returns:

  • (String)


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

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