Class: Vapi::FallbackInworldVoice

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/fallback_inworld_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_code: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackInworldVoice

Parameters:

  • caching_enabled (Boolean) (defaults to: OMIT)

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

  • voice_id (Vapi::FallbackInworldVoiceVoiceId)

    Available voices by language: • en: Alex, Ashley, Craig, Deborah, Dennis, Edward, Elizabeth, Hades, Julia, Pixie, Mark, Olivia, Priya, Ronald, Sarah, Shaun, Theodore, Timothy, Wendy, Dominus • zh: Yichen, Xiaoyin, Xinyi, Jing • nl: Erik, Katrien, Lennart, Lore • fr: Alain, Hélène, Mathieu, Étienne • de: Johanna, Josef • it: Gianni, Orietta • ja: Asuka, Satoshi • ko: Hyunwoo, Minji, Seojun, Yoona • pl: Szymon, Wojciech • pt: Heitor, Maitê • es: Diego, Lupita, Miguel, Rafael

  • model (String) (defaults to: OMIT)

    This is the model that will be used.

  • language_code (Vapi::FallbackInworldVoiceLanguageCode) (defaults to: OMIT)

    Language code for Inworld TTS synthesis

  • 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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 64

def initialize(voice_id:, caching_enabled: OMIT, model: OMIT, language_code: 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_code = language_code if language_code != OMIT
  @chunk_plan = chunk_plan if chunk_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "cachingEnabled": caching_enabled,
    "voiceId": voice_id,
    "model": model,
    "languageCode": language_code,
    "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



36
37
38
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 36

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.



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

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.



34
35
36
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 34

def chunk_plan
  @chunk_plan
end

#language_codeVapi::FallbackInworldVoiceLanguageCode (readonly)

Returns Language code for Inworld TTS synthesis.

Returns:



31
32
33
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 31

def language_code
  @language_code
end

#modelString (readonly)

Returns This is the model that will be used.

Returns:

  • (String)

    This is the model that will be used.



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

def model
  @model
end

#voice_idVapi::FallbackInworldVoiceVoiceId (readonly)

Returns Available voices by language: • en: Alex, Ashley, Craig, Deborah, Dennis, Edward, Elizabeth, Hades, Julia, Pixie, Mark, Olivia, Priya, Ronald, Sarah, Shaun, Theodore, Timothy, Wendy, Dominus • zh: Yichen, Xiaoyin, Xinyi, Jing • nl: Erik, Katrien, Lennart, Lore • fr: Alain, Hélène, Mathieu, Étienne • de: Johanna, Josef • it: Gianni, Orietta • ja: Asuka, Satoshi • ko: Hyunwoo, Minji, Seojun, Yoona • pl: Szymon, Wojciech • pt: Heitor, Maitê • es: Diego, Lupita, Miguel, Rafael.

Returns:

  • (Vapi::FallbackInworldVoiceVoiceId)

    Available voices by language: • en: Alex, Ashley, Craig, Deborah, Dennis, Edward, Elizabeth, Hades, Julia, Pixie, Mark, Olivia, Priya, Ronald, Sarah, Shaun, Theodore, Timothy, Wendy, Dominus • zh: Yichen, Xiaoyin, Xinyi, Jing • nl: Erik, Katrien, Lennart, Lore • fr: Alain, Hélène, Mathieu, Étienne • de: Johanna, Josef • it: Gianni, Orietta • ja: Asuka, Satoshi • ko: Hyunwoo, Minji, Seojun, Yoona • pl: Szymon, Wojciech • pt: Heitor, Maitê • es: Diego, Lupita, Miguel, Rafael



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

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackInworldVoice

Deserialize a JSON object to an instance of FallbackInworldVoice

Parameters:

  • json_object (String)

Returns:



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 87

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_code = parsed_json["languageCode"]
  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_code: language_code,
    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)


123
124
125
126
127
128
129
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 123

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?(Vapi::FallbackInworldVoiceVoiceId) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
  obj.model&.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language_code&.is_a?(Vapi::FallbackInworldVoiceLanguageCode) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FallbackInworldVoice to a JSON object

Returns:

  • (String)


113
114
115
# File 'lib/vapi_server_sdk/types/fallback_inworld_voice.rb', line 113

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