Class: Vapi::FallbackVapiVoice
- Inherits:
-
Object
- Object
- Vapi::FallbackVapiVoice
- Defined in:
- lib/vapi_server_sdk/types/fallback_vapi_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.
-
#speed ⇒ Float
readonly
This is the speed multiplier that will be used.
-
#voice_id ⇒ Vapi::FallbackVapiVoiceVoiceId
readonly
The voices provided by Vapi.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::FallbackVapiVoice
Deserialize a JSON object to an instance of FallbackVapiVoice.
-
.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, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackVapiVoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of FallbackVapiVoice to a JSON object.
Constructor Details
#initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackVapiVoice
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 36 def initialize(voice_id:, caching_enabled: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) @caching_enabled = caching_enabled if caching_enabled != OMIT @voice_id = voice_id @speed = speed if speed != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT @additional_properties = additional_properties @_field_set = { "cachingEnabled": caching_enabled, "voiceId": voice_id, "speed": speed, "chunkPlan": chunk_plan }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 21 def additional_properties @additional_properties end |
#caching_enabled ⇒ Boolean (readonly)
Returns This is the flag to toggle voice caching for the assistant.
11 12 13 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 11 def caching_enabled @caching_enabled end |
#chunk_plan ⇒ Vapi::ChunkPlan (readonly)
Returns This is the plan for chunking the model output before it is sent to the voice provider.
19 20 21 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 19 def chunk_plan @chunk_plan end |
#speed ⇒ Float (readonly)
Returns This is the speed multiplier that will be used. @default 1.
16 17 18 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 16 def speed @speed end |
#voice_id ⇒ Vapi::FallbackVapiVoiceVoiceId (readonly)
Returns The voices provided by Vapi.
13 14 15 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 13 def voice_id @voice_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::FallbackVapiVoice
Deserialize a JSON object to an instance of FallbackVapiVoice
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 56 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"] speed = parsed_json["speed"] 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, speed: speed, 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.
90 91 92 93 94 95 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 90 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::FallbackVapiVoiceVoiceId) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.") obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed 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 FallbackVapiVoice to a JSON object
80 81 82 |
# File 'lib/vapi_server_sdk/types/fallback_vapi_voice.rb', line 80 def to_json(*_args) @_field_set&.to_json end |