Class: Vapi::PlayHtVoice
- Inherits:
-
Object
- Object
- Vapi::PlayHtVoice
- Defined in:
- lib/vapi_server_sdk/types/play_ht_voice.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#caching_enabled ⇒ Boolean
readonly
This is the flag to toggle voice caching for the assistant.
-
#chunk_plan ⇒ Vapi::ChunkPlan
readonly
This is the plan for chunking the model output before it is sent to the voice provider.
-
#emotion ⇒ Vapi::PlayHtVoiceEmotion
readonly
An emotion to be applied to the speech.
-
#fallback_plan ⇒ Vapi::FallbackPlan
readonly
This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
-
#language ⇒ Vapi::PlayHtVoiceLanguage
readonly
The language to use for the speech.
-
#model ⇒ Vapi::PlayHtVoiceModel
readonly
Playht voice model/engine to use.
-
#speed ⇒ Float
readonly
This is the speed multiplier that will be used.
-
#style_guidance ⇒ Float
readonly
A number between 1 and 30.
-
#temperature ⇒ Float
readonly
A floating point number between 0, exclusive, and 2, inclusive.
-
#text_guidance ⇒ Float
readonly
A number between 1 and 2.
-
#voice_guidance ⇒ Float
readonly
A number between 1 and 6.
-
#voice_id ⇒ Vapi::PlayHtVoiceId
readonly
This is the provider-specific ID that will be used.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::PlayHtVoice
Deserialize a JSON object to an instance of PlayHtVoice.
-
.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.
Instance Method Summary collapse
- #initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, temperature: OMIT, emotion: OMIT, voice_guidance: OMIT, style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::PlayHtVoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PlayHtVoice to a JSON object.
Constructor Details
#initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, temperature: OMIT, emotion: OMIT, voice_guidance: OMIT, style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::PlayHtVoice
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 84 def initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, temperature: OMIT, emotion: OMIT, voice_guidance: OMIT, style_guidance: OMIT, text_guidance: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) @caching_enabled = caching_enabled if caching_enabled != OMIT @voice_id = voice_id @speed = speed if speed != OMIT @temperature = temperature if temperature != OMIT @emotion = emotion if emotion != OMIT @voice_guidance = voice_guidance if voice_guidance != OMIT @style_guidance = style_guidance if style_guidance != OMIT @text_guidance = text_guidance if text_guidance != OMIT @model = model if model != OMIT @language = language if language != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { "cachingEnabled": caching_enabled, "voiceId": voice_id, "speed": speed, "temperature": temperature, "emotion": emotion, "voiceGuidance": voice_guidance, "styleGuidance": style_guidance, "textGuidance": text_guidance, "model": model, "language": language, "chunkPlan": chunk_plan, "fallbackPlan": fallback_plan }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
51 52 53 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 51 def additional_properties @additional_properties end |
#caching_enabled ⇒ Boolean (readonly)
15 16 17 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 15 def caching_enabled @caching_enabled end |
#chunk_plan ⇒ Vapi::ChunkPlan (readonly)
46 47 48 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 46 def chunk_plan @chunk_plan end |
#emotion ⇒ Vapi::PlayHtVoiceEmotion (readonly)
27 28 29 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 27 def emotion @emotion end |
#fallback_plan ⇒ Vapi::FallbackPlan (readonly)
49 50 51 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 49 def fallback_plan @fallback_plan end |
#language ⇒ Vapi::PlayHtVoiceLanguage (readonly)
43 44 45 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 43 def language @language end |
#model ⇒ Vapi::PlayHtVoiceModel (readonly)
41 42 43 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 41 def model @model end |
#speed ⇒ Float (readonly)
19 20 21 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 19 def speed @speed end |
#style_guidance ⇒ Float (readonly)
33 34 35 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 33 def style_guidance @style_guidance end |
#temperature ⇒ Float (readonly)
25 26 27 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 25 def temperature @temperature end |
#text_guidance ⇒ Float (readonly)
39 40 41 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 39 def text_guidance @text_guidance end |
#voice_guidance ⇒ Float (readonly)
30 31 32 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 30 def voice_guidance @voice_guidance end |
#voice_id ⇒ Vapi::PlayHtVoiceId (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 17 def voice_id @voice_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::PlayHtVoice
Deserialize a JSON object to an instance of PlayHtVoice
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 121 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"] if parsed_json["voiceId"].nil? voice_id = nil else voice_id = parsed_json["voiceId"].to_json voice_id = Vapi::PlayHtVoiceId.from_json(json_object: voice_id) end speed = parsed_json["speed"] temperature = parsed_json["temperature"] emotion = parsed_json["emotion"] voice_guidance = parsed_json["voiceGuidance"] style_guidance = parsed_json["styleGuidance"] text_guidance = parsed_json["textGuidance"] model = parsed_json["model"] language = parsed_json["language"] 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 if parsed_json["fallbackPlan"].nil? fallback_plan = nil else fallback_plan = parsed_json["fallbackPlan"].to_json fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) end new( caching_enabled: caching_enabled, voice_id: voice_id, speed: speed, temperature: temperature, emotion: emotion, voice_guidance: voice_guidance, style_guidance: style_guidance, text_guidance: text_guidance, model: model, language: language, chunk_plan: chunk_plan, 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.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 181 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.") Vapi::PlayHtVoiceId.validate_raw(obj: obj.voice_id) obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") obj.emotion&.is_a?(Vapi::PlayHtVoiceEmotion) != false || raise("Passed value for field obj.emotion is not the expected type, validation failed.") obj.voice_guidance&.is_a?(Float) != false || raise("Passed value for field obj.voice_guidance is not the expected type, validation failed.") obj.style_guidance&.is_a?(Float) != false || raise("Passed value for field obj.style_guidance is not the expected type, validation failed.") obj.text_guidance&.is_a?(Float) != false || raise("Passed value for field obj.text_guidance is not the expected type, validation failed.") obj.model&.is_a?(Vapi::PlayHtVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.language&.is_a?(Vapi::PlayHtVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PlayHtVoice to a JSON object
171 172 173 |
# File 'lib/vapi_server_sdk/types/play_ht_voice.rb', line 171 def to_json(*_args) @_field_set&.to_json end |