Class: Vapi::CartesiaVoice
- Inherits:
-
Object
- Object
- Vapi::CartesiaVoice
- Defined in:
- lib/vapi_server_sdk/types/cartesia_voice.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#chunk_plan ⇒ Vapi::ChunkPlan
readonly
This is the plan for chunking the model output before it is sent to the voice provider.
-
#filler_injection_enabled ⇒ Boolean
readonly
This determines whether fillers are injected into the model output before inputting it into the voice provider.
-
#language ⇒ Vapi::CartesiaVoiceLanguage
readonly
This is the language that will be used.
-
#model ⇒ Vapi::CartesiaVoiceModel
readonly
This is the model that will be used.
-
#voice_id ⇒ String
readonly
This is the provider-specific ID that will be used.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CartesiaVoice
Deserialize a JSON object to an instance of CartesiaVoice.
-
.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:, filler_injection_enabled: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::CartesiaVoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CartesiaVoice to a JSON object.
Constructor Details
#initialize(voice_id:, filler_injection_enabled: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::CartesiaVoice
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 46 def initialize(voice_id:, filler_injection_enabled: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) @filler_injection_enabled = filler_injection_enabled if filler_injection_enabled != OMIT @model = model if model != OMIT @language = language if language != OMIT @voice_id = voice_id @chunk_plan = chunk_plan if chunk_plan != OMIT @additional_properties = additional_properties @_field_set = { "fillerInjectionEnabled": filler_injection_enabled, "model": model, "language": language, "voiceId": voice_id, "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.
27 28 29 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 27 def additional_properties @additional_properties end |
#chunk_plan ⇒ Vapi::ChunkPlan (readonly)
Returns This is the plan for chunking the model output before it is sent to the voice provider.
25 26 27 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 25 def chunk_plan @chunk_plan end |
#filler_injection_enabled ⇒ Boolean (readonly)
Returns This determines whether fillers are injected into the model output before inputting it into the voice provider. Default ‘false` because you can achieve better results with prompting the model.
14 15 16 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 14 def filler_injection_enabled @filler_injection_enabled end |
#language ⇒ Vapi::CartesiaVoiceLanguage (readonly)
Returns This is the language that will be used. This is optional and will default to the correct language for the voiceId.
20 21 22 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 20 def language @language end |
#model ⇒ Vapi::CartesiaVoiceModel (readonly)
Returns This is the model that will be used. This is optional and will default to the correct model for the voiceId.
17 18 19 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 17 def model @model end |
#voice_id ⇒ String (readonly)
Returns This is the provider-specific ID that will be used.
22 23 24 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 22 def voice_id @voice_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CartesiaVoice
Deserialize a JSON object to an instance of CartesiaVoice
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 69 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) filler_injection_enabled = parsed_json["fillerInjectionEnabled"] model = parsed_json["model"] language = parsed_json["language"] voice_id = parsed_json["voiceId"] 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( filler_injection_enabled: filler_injection_enabled, model: model, language: language, voice_id: voice_id, 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.
105 106 107 108 109 110 111 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 105 def self.validate_raw(obj:) obj.filler_injection_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.filler_injection_enabled is not the expected type, validation failed.") obj.model&.is_a?(Vapi::CartesiaVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.language&.is_a?(Vapi::CartesiaVoiceLanguage) != false || raise("Passed value for field obj.language 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.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CartesiaVoice to a JSON object
95 96 97 |
# File 'lib/vapi_server_sdk/types/cartesia_voice.rb', line 95 def to_json(*_args) @_field_set&.to_json end |