Class: Vapi::TavusVoice
- Inherits:
-
Object
- Object
- Vapi::TavusVoice
- Defined in:
- lib/vapi_server_sdk/types/tavus_voice.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#callback_url ⇒ String
readonly
This is the url that will receive webhooks with updates regarding the conversation state.
-
#chunk_plan ⇒ Vapi::ChunkPlan
readonly
This is the plan for chunking the model output before it is sent to the voice provider.
-
#conversation_name ⇒ String
readonly
This is the name for the conversation.
-
#conversational_context ⇒ String
readonly
This is the context that will be appended to any context provided in the persona, if one is provided.
-
#custom_greeting ⇒ String
readonly
This is the custom greeting that the replica will give once a participant joines the conversation.
-
#fallback_plan ⇒ Vapi::FallbackPlan
readonly
This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
-
#persona_id ⇒ String
readonly
This is the unique identifier for the persona that the replica will use in the conversation.
-
#properties ⇒ Vapi::TavusConversationProperties
readonly
These are optional properties used to customize the conversation.
-
#voice_id ⇒ Vapi::TavusVoiceVoiceId
readonly
This is the provider-specific ID that will be used.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TavusVoice
Deserialize a JSON object to an instance of TavusVoice.
-
.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:, chunk_plan: OMIT, persona_id: OMIT, callback_url: OMIT, conversation_name: OMIT, conversational_context: OMIT, custom_greeting: OMIT, properties: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::TavusVoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TavusVoice to a JSON object.
Constructor Details
#initialize(voice_id:, chunk_plan: OMIT, persona_id: OMIT, callback_url: OMIT, conversation_name: OMIT, conversational_context: OMIT, custom_greeting: OMIT, properties: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::TavusVoice
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 61 def initialize(voice_id:, chunk_plan: OMIT, persona_id: OMIT, callback_url: OMIT, conversation_name: OMIT, conversational_context: OMIT, custom_greeting: OMIT, properties: OMIT, fallback_plan: OMIT, additional_properties: nil) @voice_id = voice_id @chunk_plan = chunk_plan if chunk_plan != OMIT @persona_id = persona_id if persona_id != OMIT @callback_url = callback_url if callback_url != OMIT @conversation_name = conversation_name if conversation_name != OMIT @conversational_context = conversational_context if conversational_context != OMIT @custom_greeting = custom_greeting if custom_greeting != OMIT @properties = properties if properties != OMIT @fallback_plan = fallback_plan if fallback_plan != OMIT @additional_properties = additional_properties @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan, "personaId": persona_id, "callbackUrl": callback_url, "conversationName": conversation_name, "conversationalContext": conversational_context, "customGreeting": custom_greeting, "properties": properties, "fallbackPlan": fallback_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.
37 38 39 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 37 def additional_properties @additional_properties end |
#callback_url ⇒ String (readonly)
Returns This is the url that will receive webhooks with updates regarding the conversation state.
22 23 24 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 22 def callback_url @callback_url end |
#chunk_plan ⇒ Vapi::ChunkPlan (readonly)
Returns This is the plan for chunking the model output before it is sent to the voice provider.
16 17 18 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 16 def chunk_plan @chunk_plan end |
#conversation_name ⇒ String (readonly)
Returns This is the name for the conversation.
24 25 26 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 24 def conversation_name @conversation_name end |
#conversational_context ⇒ String (readonly)
Returns This is the context that will be appended to any context provided in the persona, if one is provided.
27 28 29 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 27 def conversational_context @conversational_context end |
#custom_greeting ⇒ String (readonly)
Returns This is the custom greeting that the replica will give once a participant joines the conversation.
30 31 32 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 30 def custom_greeting @custom_greeting end |
#fallback_plan ⇒ Vapi::FallbackPlan (readonly)
Returns This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
35 36 37 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 35 def fallback_plan @fallback_plan end |
#persona_id ⇒ String (readonly)
Returns This is the unique identifier for the persona that the replica will use in the conversation.
19 20 21 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 19 def persona_id @persona_id end |
#properties ⇒ Vapi::TavusConversationProperties (readonly)
Returns These are optional properties used to customize the conversation.
32 33 34 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 32 def properties @properties end |
#voice_id ⇒ Vapi::TavusVoiceVoiceId (readonly)
Returns This is the provider-specific ID that will be used.
13 14 15 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 13 def voice_id @voice_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TavusVoice
Deserialize a JSON object to an instance of TavusVoice
92 93 94 95 96 97 98 99 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/tavus_voice.rb', line 92 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::TavusVoiceVoiceId.from_json(json_object: voice_id) end 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 persona_id = parsed_json["personaId"] callback_url = parsed_json["callbackUrl"] conversation_name = parsed_json["conversationName"] conversational_context = parsed_json["conversationalContext"] custom_greeting = parsed_json["customGreeting"] if parsed_json["properties"].nil? properties = nil else properties = parsed_json["properties"].to_json properties = Vapi::TavusConversationProperties.from_json(json_object: properties) 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( voice_id: voice_id, chunk_plan: chunk_plan, persona_id: persona_id, callback_url: callback_url, conversation_name: conversation_name, conversational_context: conversational_context, custom_greeting: custom_greeting, properties: properties, 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.
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 151 def self.validate_raw(obj:) Vapi::TavusVoiceVoiceId.validate_raw(obj: obj.voice_id) obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) obj.persona_id&.is_a?(String) != false || raise("Passed value for field obj.persona_id is not the expected type, validation failed.") obj.callback_url&.is_a?(String) != false || raise("Passed value for field obj.callback_url is not the expected type, validation failed.") obj.conversation_name&.is_a?(String) != false || raise("Passed value for field obj.conversation_name is not the expected type, validation failed.") obj.conversational_context&.is_a?(String) != false || raise("Passed value for field obj.conversational_context is not the expected type, validation failed.") obj.custom_greeting&.is_a?(String) != false || raise("Passed value for field obj.custom_greeting is not the expected type, validation failed.") obj.properties.nil? || Vapi::TavusConversationProperties.validate_raw(obj: obj.properties) obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TavusVoice to a JSON object
141 142 143 |
# File 'lib/vapi_server_sdk/types/tavus_voice.rb', line 141 def to_json(*_args) @_field_set&.to_json end |