Class: Vapi::FallbackCartesiaVoice

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice_id:, caching_enabled: OMIT, model: OMIT, language: OMIT, experimental_controls: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackCartesiaVoice

Parameters:

  • caching_enabled (Boolean) (defaults to: OMIT)

    This is the flag to toggle voice caching for the assistant.

  • voice_id (String)

    The ID of the particular voice you want to use.

  • model (Vapi::FallbackCartesiaVoiceModel) (defaults to: OMIT)

    This is the model that will be used. This is optional and will default to the correct model for the voiceId.

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

    This is the language that will be used. This is optional and will default to the correct language for the voiceId.

  • experimental_controls (Vapi::CartesiaExperimentalControls) (defaults to: OMIT)

    Experimental controls for Cartesia voice generation

  • chunk_plan (Vapi::ChunkPlan) (defaults to: OMIT)

    This is the plan for chunking the model output before it is sent to the voice provider.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(voice_id:, caching_enabled: OMIT, model: OMIT, language: OMIT, experimental_controls: OMIT,
               chunk_plan: OMIT, additional_properties: nil)
  @caching_enabled = caching_enabled if caching_enabled != OMIT
  @voice_id = voice_id
  @model = model if model != OMIT
  @language = language if language != OMIT
  @experimental_controls = experimental_controls if experimental_controls != OMIT
  @chunk_plan = chunk_plan if chunk_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "cachingEnabled": caching_enabled,
    "voiceId": voice_id,
    "model": model,
    "language": language,
    "experimentalControls": experimental_controls,
    "chunkPlan": chunk_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



28
29
30
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 28

def additional_properties
  @additional_properties
end

#caching_enabledBoolean (readonly)

Returns This is the flag to toggle voice caching for the assistant.

Returns:

  • (Boolean)

    This is the flag to toggle voice caching for the assistant.



13
14
15
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 13

def caching_enabled
  @caching_enabled
end

#chunk_planVapi::ChunkPlan (readonly)

Returns This is the plan for chunking the model output before it is sent to the voice provider.

Returns:

  • (Vapi::ChunkPlan)

    This is the plan for chunking the model output before it is sent to the voice provider.



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

def chunk_plan
  @chunk_plan
end

#experimental_controlsVapi::CartesiaExperimentalControls (readonly)

Returns Experimental controls for Cartesia voice generation.

Returns:



23
24
25
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 23

def experimental_controls
  @experimental_controls
end

#languageVapi::FallbackCartesiaVoiceLanguage (readonly)

Returns This is the language that will be used. This is optional and will default to the correct language for the voiceId.

Returns:



21
22
23
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 21

def language
  @language
end

#modelVapi::FallbackCartesiaVoiceModel (readonly)

Returns This is the model that will be used. This is optional and will default to the correct model for the voiceId.

Returns:



18
19
20
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 18

def model
  @model
end

#voice_idString (readonly)

Returns The ID of the particular voice you want to use.

Returns:

  • (String)

    The ID of the particular voice you want to use.



15
16
17
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 15

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackCartesiaVoice

Deserialize a JSON object to an instance of FallbackCartesiaVoice

Parameters:

  • json_object (String)

Returns:



71
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
98
99
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 71

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  caching_enabled = parsed_json["cachingEnabled"]
  voice_id = parsed_json["voiceId"]
  model = parsed_json["model"]
  language = parsed_json["language"]
  if parsed_json["experimentalControls"].nil?
    experimental_controls = nil
  else
    experimental_controls = parsed_json["experimentalControls"].to_json
    experimental_controls = Vapi::CartesiaExperimentalControls.from_json(json_object: experimental_controls)
  end
  if parsed_json["chunkPlan"].nil?
    chunk_plan = nil
  else
    chunk_plan = parsed_json["chunkPlan"].to_json
    chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan)
  end
  new(
    caching_enabled: caching_enabled,
    voice_id: voice_id,
    model: model,
    language: language,
    experimental_controls: experimental_controls,
    chunk_plan: chunk_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)


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

def self.validate_raw(obj:)
  obj.caching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.caching_enabled is not the expected type, validation failed.")
  obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
  obj.model&.is_a?(Vapi::FallbackCartesiaVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language&.is_a?(Vapi::FallbackCartesiaVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
  obj.experimental_controls.nil? || Vapi::CartesiaExperimentalControls.validate_raw(obj: obj.experimental_controls)
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FallbackCartesiaVoice to a JSON object

Returns:

  • (String)


104
105
106
# File 'lib/vapi_server_sdk/types/fallback_cartesia_voice.rb', line 104

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