Class: Vapi::AssistantVoice
- Inherits:
-
Object
- Object
- Vapi::AssistantVoice
- Defined in:
- lib/vapi_server_sdk/types/assistant_voice.rb
Overview
These are the options for the assistant’s voice.
Instance Attribute Summary collapse
- #discriminant ⇒ String readonly
- #member ⇒ Object readonly
Class Method Summary collapse
- ._11_labs(member:) ⇒ Vapi::AssistantVoice
- .azure(member:) ⇒ Vapi::AssistantVoice
- .cartesia(member:) ⇒ Vapi::AssistantVoice
- .deepgram(member:) ⇒ Vapi::AssistantVoice
-
.from_json(json_object:) ⇒ Vapi::AssistantVoice
Deserialize a JSON object to an instance of AssistantVoice.
- .lmnt(member:) ⇒ Vapi::AssistantVoice
- .neets(member:) ⇒ Vapi::AssistantVoice
- .openai(member:) ⇒ Vapi::AssistantVoice
- .playht(member:) ⇒ Vapi::AssistantVoice
- .rime_ai(member:) ⇒ Vapi::AssistantVoice
-
.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(member:, discriminant:) ⇒ Vapi::AssistantVoice constructor
-
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
- #kind_of? ⇒ Object
-
#to_json(*_args) ⇒ String
For Union Types, to_json functionality is delegated to the wrapped member.
Constructor Details
#initialize(member:, discriminant:) ⇒ Vapi::AssistantVoice
28 29 30 31 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 28 def initialize(member:, discriminant:) @member = member @discriminant = discriminant end |
Instance Attribute Details
#discriminant ⇒ String (readonly)
20 21 22 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 20 def discriminant @discriminant end |
#member ⇒ Object (readonly)
18 19 20 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 18 def member @member end |
Class Method Details
._11_labs(member:) ⇒ Vapi::AssistantVoice
152 153 154 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 152 def self._11_labs(member:) new(member: member, discriminant: "11labs") end |
.azure(member:) ⇒ Vapi::AssistantVoice
134 135 136 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 134 def self.azure(member:) new(member: member, discriminant: "azure") end |
.cartesia(member:) ⇒ Vapi::AssistantVoice
140 141 142 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 140 def self.cartesia(member:) new(member: member, discriminant: "cartesia") end |
.deepgram(member:) ⇒ Vapi::AssistantVoice
146 147 148 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 146 def self.deepgram(member:) new(member: member, discriminant: "deepgram") end |
.from_json(json_object:) ⇒ Vapi::AssistantVoice
Deserialize a JSON object to an instance of AssistantVoice
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.provider when "azure" Vapi::AzureVoice.from_json(json_object: json_object) when "cartesia" Vapi::CartesiaVoice.from_json(json_object: json_object) when "deepgram" Vapi::DeepgramVoice.from_json(json_object: json_object) when "11labs" Vapi::ElevenLabsVoice.from_json(json_object: json_object) when "lmnt" Vapi::LmntVoice.from_json(json_object: json_object) when "neets" Vapi::NeetsVoice.from_json(json_object: json_object) when "openai" Vapi::OpenAiVoice.from_json(json_object: json_object) when "playht" Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) else Vapi::AzureVoice.from_json(json_object: json_object) end new(member: member, discriminant: struct.provider) end |
.lmnt(member:) ⇒ Vapi::AssistantVoice
158 159 160 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 158 def self.lmnt(member:) new(member: member, discriminant: "lmnt") end |
.neets(member:) ⇒ Vapi::AssistantVoice
164 165 166 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 164 def self.neets(member:) new(member: member, discriminant: "neets") end |
.openai(member:) ⇒ Vapi::AssistantVoice
170 171 172 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 170 def self.openai(member:) new(member: member, discriminant: "openai") end |
.playht(member:) ⇒ Vapi::AssistantVoice
176 177 178 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 176 def self.playht(member:) new(member: member, discriminant: "playht") end |
.rime_ai(member:) ⇒ Vapi::AssistantVoice
182 183 184 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 182 def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") 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.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 99 def self.validate_raw(obj:) case obj.provider when "azure" Vapi::AzureVoice.validate_raw(obj: obj) when "cartesia" Vapi::CartesiaVoice.validate_raw(obj: obj) when "deepgram" Vapi::DeepgramVoice.validate_raw(obj: obj) when "11labs" Vapi::ElevenLabsVoice.validate_raw(obj: obj) when "lmnt" Vapi::LmntVoice.validate_raw(obj: obj) when "neets" Vapi::NeetsVoice.validate_raw(obj: obj) when "openai" Vapi::OpenAiVoice.validate_raw(obj: obj) when "playht" Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) else raise("Passed value matched no type within the union, validation failed.") end end |
Instance Method Details
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
128 129 130 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 128 def is_a?(obj) @member.is_a?(obj) end |
#kind_of? ⇒ Object
23 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 23 alias kind_of? is_a? |
#to_json(*_args) ⇒ String
For Union Types, to_json functionality is delegated to the wrapped member.
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 |
# File 'lib/vapi_server_sdk/types/assistant_voice.rb', line 67 def to_json(*_args) case @discriminant when "azure" { **@member.to_json, provider: @discriminant }.to_json when "cartesia" { **@member.to_json, provider: @discriminant }.to_json when "deepgram" { **@member.to_json, provider: @discriminant }.to_json when "11labs" { **@member.to_json, provider: @discriminant }.to_json when "lmnt" { **@member.to_json, provider: @discriminant }.to_json when "neets" { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "playht" { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json else { "provider": @discriminant, value: @member }.to_json end @member.to_json end |