Class: Vapi::FallbackElevenLabsVoice
- Inherits:
-
Object
- Object
- Vapi::FallbackElevenLabsVoice
- Defined in:
- lib/vapi_server_sdk/types/fallback_eleven_labs_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.
-
#enable_ssml_parsing ⇒ Boolean
readonly
This enables the use of https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation.
-
#language ⇒ String
readonly
This is the language (ISO 639-1) that is enforced for the model.
-
#model ⇒ Vapi::FallbackElevenLabsVoiceModel
readonly
This is the model that will be used.
-
#optimize_streaming_latency ⇒ Float
readonly
Defines the optimize streaming latency for voice settings.
-
#similarity_boost ⇒ Float
readonly
Defines the similarity boost for voice settings.
-
#stability ⇒ Float
readonly
Defines the stability for voice settings.
-
#style ⇒ Float
readonly
Defines the style for voice settings.
-
#use_speaker_boost ⇒ Boolean
readonly
Defines the use speaker boost for voice settings.
-
#voice_id ⇒ Vapi::FallbackElevenLabsVoiceId
readonly
This is the provider-specific ID that will be used.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::FallbackElevenLabsVoice
Deserialize a JSON object to an instance of FallbackElevenLabsVoice.
-
.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:, stability: OMIT, similarity_boost: OMIT, style: OMIT, use_speaker_boost: OMIT, optimize_streaming_latency: OMIT, enable_ssml_parsing: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackElevenLabsVoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of FallbackElevenLabsVoice to a JSON object.
Constructor Details
#initialize(voice_id:, stability: OMIT, similarity_boost: OMIT, style: OMIT, use_speaker_boost: OMIT, optimize_streaming_latency: OMIT, enable_ssml_parsing: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) ⇒ Vapi::FallbackElevenLabsVoice
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 67 def initialize(voice_id:, stability: OMIT, similarity_boost: OMIT, style: OMIT, use_speaker_boost: OMIT, optimize_streaming_latency: OMIT, enable_ssml_parsing: OMIT, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil) @voice_id = voice_id @stability = stability if stability != OMIT @similarity_boost = similarity_boost if similarity_boost != OMIT @style = style if style != OMIT @use_speaker_boost = use_speaker_boost if use_speaker_boost != OMIT @optimize_streaming_latency = optimize_streaming_latency if optimize_streaming_latency != OMIT @enable_ssml_parsing = enable_ssml_parsing if enable_ssml_parsing != OMIT @model = model if model != OMIT @language = language if language != OMIT @chunk_plan = chunk_plan if chunk_plan != OMIT @additional_properties = additional_properties @_field_set = { "voiceId": voice_id, "stability": stability, "similarityBoost": similarity_boost, "style": style, "useSpeakerBoost": use_speaker_boost, "optimizeStreamingLatency": optimize_streaming_latency, "enableSsmlParsing": enable_ssml_parsing, "model": model, "language": language, "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.
40 41 42 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 40 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.
38 39 40 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 38 def chunk_plan @chunk_plan end |
#enable_ssml_parsing ⇒ Boolean (readonly)
Returns This enables the use of https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation. Defaults to false to save latency. @default false.
28 29 30 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 28 def enable_ssml_parsing @enable_ssml_parsing end |
#language ⇒ String (readonly)
This is the language (ISO 639-1) that is enforced for the model. Currently only Turbo v2.5 supports language enforcement. For other models, an error will be returned if language code is provided.
35 36 37 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 35 def language @language end |
#model ⇒ Vapi::FallbackElevenLabsVoiceModel (readonly)
Returns This is the model that will be used. Defaults to 'eleven_turbo_v2' if not specified.
31 32 33 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 31 def model @model end |
#optimize_streaming_latency ⇒ Float (readonly)
Returns Defines the optimize streaming latency for voice settings. Defaults to 3.
23 24 25 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 23 def optimize_streaming_latency @optimize_streaming_latency end |
#similarity_boost ⇒ Float (readonly)
Returns Defines the similarity boost for voice settings.
17 18 19 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 17 def similarity_boost @similarity_boost end |
#stability ⇒ Float (readonly)
Returns Defines the stability for voice settings.
15 16 17 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 15 def stability @stability end |
#style ⇒ Float (readonly)
Returns Defines the style for voice settings.
19 20 21 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 19 def style @style end |
#use_speaker_boost ⇒ Boolean (readonly)
Returns Defines the use speaker boost for voice settings.
21 22 23 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 21 def use_speaker_boost @use_speaker_boost end |
#voice_id ⇒ Vapi::FallbackElevenLabsVoiceId (readonly)
Returns This is the provider-specific ID that will be used. Ensure the Voice is present in your 11Labs Voice Library.
13 14 15 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 13 def voice_id @voice_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::FallbackElevenLabsVoice
Deserialize a JSON object to an instance of FallbackElevenLabsVoice
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 100 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["voiceId"].nil? voice_id = nil else voice_id = parsed_json["voiceId"].to_json voice_id = Vapi::FallbackElevenLabsVoiceId.from_json(json_object: voice_id) end stability = parsed_json["stability"] similarity_boost = parsed_json["similarityBoost"] style = parsed_json["style"] use_speaker_boost = parsed_json["useSpeakerBoost"] optimize_streaming_latency = parsed_json["optimizeStreamingLatency"] enable_ssml_parsing = parsed_json["enableSsmlParsing"] 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 new( voice_id: voice_id, stability: stability, similarity_boost: similarity_boost, style: style, use_speaker_boost: use_speaker_boost, optimize_streaming_latency: optimize_streaming_latency, enable_ssml_parsing: enable_ssml_parsing, model: model, language: language, 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.
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 151 def self.validate_raw(obj:) Vapi::FallbackElevenLabsVoiceId.validate_raw(obj: obj.voice_id) obj.stability&.is_a?(Float) != false || raise("Passed value for field obj.stability is not the expected type, validation failed.") obj.similarity_boost&.is_a?(Float) != false || raise("Passed value for field obj.similarity_boost is not the expected type, validation failed.") obj.style&.is_a?(Float) != false || raise("Passed value for field obj.style is not the expected type, validation failed.") obj.use_speaker_boost&.is_a?(Boolean) != false || raise("Passed value for field obj.use_speaker_boost is not the expected type, validation failed.") obj.optimize_streaming_latency&.is_a?(Float) != false || raise("Passed value for field obj.optimize_streaming_latency is not the expected type, validation failed.") obj.enable_ssml_parsing&.is_a?(Boolean) != false || raise("Passed value for field obj.enable_ssml_parsing is not the expected type, validation failed.") obj.model&.is_a?(Vapi::FallbackElevenLabsVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.language&.is_a?(String) != 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) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of FallbackElevenLabsVoice to a JSON object
141 142 143 |
# File 'lib/vapi_server_sdk/types/fallback_eleven_labs_voice.rb', line 141 def to_json(*_args) @_field_set&.to_json end |