Class: Vapi::StartSpeakingPlan
- Inherits:
-
Object
- Object
- Vapi::StartSpeakingPlan
- Defined in:
- lib/vapi_server_sdk/types/start_speaking_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#custom_endpointing_rules ⇒ Array<Vapi::StartSpeakingPlanCustomEndpointingRulesItem>
readonly
These are the custom endpointing rules to set an endpointing timeout based on a regex on the customer’s speech or the assistant’s last message.
- #smart_endpointing_enabled ⇒ Vapi::StartSpeakingPlanSmartEndpointingEnabled readonly
-
#smart_endpointing_plan ⇒ Vapi::StartSpeakingPlanSmartEndpointingPlan
readonly
This is the plan for smart endpointing.
-
#transcription_endpointing_plan ⇒ Vapi::TranscriptionEndpointingPlan
readonly
This determines how a customer speech is considered done (endpointing) using the transcription of customer’s speech.
-
#wait_seconds ⇒ Float
readonly
This is how long assistant waits before speaking.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::StartSpeakingPlan
Deserialize a JSON object to an instance of StartSpeakingPlan.
-
.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(wait_seconds: OMIT, smart_endpointing_enabled: OMIT, smart_endpointing_plan: OMIT, custom_endpointing_rules: OMIT, transcription_endpointing_plan: OMIT, additional_properties: nil) ⇒ Vapi::StartSpeakingPlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of StartSpeakingPlan to a JSON object.
Constructor Details
#initialize(wait_seconds: OMIT, smart_endpointing_enabled: OMIT, smart_endpointing_plan: OMIT, custom_endpointing_rules: OMIT, transcription_endpointing_plan: OMIT, additional_properties: nil) ⇒ Vapi::StartSpeakingPlan
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 115 def initialize(wait_seconds: OMIT, smart_endpointing_enabled: OMIT, smart_endpointing_plan: OMIT, custom_endpointing_rules: OMIT, transcription_endpointing_plan: OMIT, additional_properties: nil) @wait_seconds = wait_seconds if wait_seconds != OMIT @smart_endpointing_enabled = smart_endpointing_enabled if smart_endpointing_enabled != OMIT @smart_endpointing_plan = smart_endpointing_plan if smart_endpointing_plan != OMIT @custom_endpointing_rules = custom_endpointing_rules if custom_endpointing_rules != OMIT @transcription_endpointing_plan = transcription_endpointing_plan if transcription_endpointing_plan != OMIT @additional_properties = additional_properties @_field_set = { "waitSeconds": wait_seconds, "smartEndpointingEnabled": smart_endpointing_enabled, "smartEndpointingPlan": smart_endpointing_plan, "customEndpointingRules": custom_endpointing_rules, "transcriptionEndpointingPlan": transcription_endpointing_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.
62 63 64 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 62 def additional_properties @additional_properties end |
#custom_endpointing_rules ⇒ Array<Vapi::StartSpeakingPlanCustomEndpointingRulesItem> (readonly)
Returns These are the custom endpointing rules to set an endpointing timeout based on a regex on the customer’s speech or the assistant’s last message. Usage:
-
If you have yes/no questions like “are you interested in a loan?”, you can set
a shorter timeout.
-
If you have questions where the customer may pause to look up information like
“what’s my account number?”, you can set a longer timeout.
-
If you want to wait longer while customer is enumerating a list of numbers,
you can set a longer timeout. These rules have the highest precedence and will override both ‘smartEndpointingPlan` and `transcriptionEndpointingPlan` when a rule is matched. The rules are evaluated in order and the first one that matches will be used. Order of precedence for endpointing:
-
customEndpointingRules (if any match)
-
smartEndpointingPlan (if set)
-
transcriptionEndpointingPlan
@default [].
53 54 55 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 53 def custom_endpointing_rules @custom_endpointing_rules end |
#smart_endpointing_enabled ⇒ Vapi::StartSpeakingPlanSmartEndpointingEnabled (readonly)
26 27 28 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 26 def smart_endpointing_enabled @smart_endpointing_enabled end |
#smart_endpointing_plan ⇒ Vapi::StartSpeakingPlanSmartEndpointingPlan (readonly)
Returns This is the plan for smart endpointing. Pick between Vapi smart endpointing or LiveKit smart endpointing (or nothing). We strongly recommend using livekit endpointing when working in English. LiveKit endpointing is not supported in other languages, yet. If this is set, it will override and take precedence over ‘transcriptionEndpointingPlan`. This plan will still be overridden by any matching `customEndpointingRules`.
34 35 36 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 34 def smart_endpointing_plan @smart_endpointing_plan end |
#transcription_endpointing_plan ⇒ Vapi::TranscriptionEndpointingPlan (readonly)
Returns This determines how a customer speech is considered done (endpointing) using the transcription of customer’s speech. Once an endpoint is triggered, the request is sent to ‘assistant.model`. Note: This plan is only used if `smartEndpointingPlan` is not set. If both are provided, `smartEndpointingPlan` takes precedence. This plan will also be overridden by any matching `customEndpointingRules`.
60 61 62 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 60 def transcription_endpointing_plan @transcription_endpointing_plan end |
#wait_seconds ⇒ Float (readonly)
Returns This is how long assistant waits before speaking. Defaults to 0.4. This is the minimum it will wait but if there is latency is the pipeline, this minimum will be exceeded. This is intended as a stopgap in case the pipeline is moving too fast. Example:
-
If model generates tokens and voice generates bytes within 100ms, the pipeline
still waits 300ms before outputting speech. Usage:
-
If the customer is taking long pauses, set this to a higher value.
-
If the assistant is accidentally jumping in too much, set this to a higher
value. @default 0.4.
24 25 26 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 24 def wait_seconds @wait_seconds end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::StartSpeakingPlan
Deserialize a JSON object to an instance of StartSpeakingPlan
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 138 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) wait_seconds = parsed_json["waitSeconds"] if parsed_json["smartEndpointingEnabled"].nil? smart_endpointing_enabled = nil else smart_endpointing_enabled = parsed_json["smartEndpointingEnabled"].to_json smart_endpointing_enabled = Vapi::StartSpeakingPlanSmartEndpointingEnabled.from_json(json_object: smart_endpointing_enabled) end if parsed_json["smartEndpointingPlan"].nil? smart_endpointing_plan = nil else smart_endpointing_plan = parsed_json["smartEndpointingPlan"].to_json smart_endpointing_plan = Vapi::StartSpeakingPlanSmartEndpointingPlan.from_json(json_object: smart_endpointing_plan) end custom_endpointing_rules = parsed_json["customEndpointingRules"]&.map do |item| item = item.to_json Vapi::StartSpeakingPlanCustomEndpointingRulesItem.from_json(json_object: item) end if parsed_json["transcriptionEndpointingPlan"].nil? transcription_endpointing_plan = nil else transcription_endpointing_plan = parsed_json["transcriptionEndpointingPlan"].to_json transcription_endpointing_plan = Vapi::TranscriptionEndpointingPlan.from_json(json_object: transcription_endpointing_plan) end new( wait_seconds: wait_seconds, smart_endpointing_enabled: smart_endpointing_enabled, smart_endpointing_plan: smart_endpointing_plan, custom_endpointing_rules: custom_endpointing_rules, transcription_endpointing_plan: transcription_endpointing_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.
187 188 189 190 191 192 193 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 187 def self.validate_raw(obj:) obj.wait_seconds&.is_a?(Float) != false || raise("Passed value for field obj.wait_seconds is not the expected type, validation failed.") obj.smart_endpointing_enabled.nil? || Vapi::StartSpeakingPlanSmartEndpointingEnabled.validate_raw(obj: obj.smart_endpointing_enabled) obj.smart_endpointing_plan.nil? || Vapi::StartSpeakingPlanSmartEndpointingPlan.validate_raw(obj: obj.smart_endpointing_plan) obj.custom_endpointing_rules&.is_a?(Array) != false || raise("Passed value for field obj.custom_endpointing_rules is not the expected type, validation failed.") obj.transcription_endpointing_plan.nil? || Vapi::TranscriptionEndpointingPlan.validate_raw(obj: obj.transcription_endpointing_plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of StartSpeakingPlan to a JSON object
177 178 179 |
# File 'lib/vapi_server_sdk/types/start_speaking_plan.rb', line 177 def to_json(*_args) @_field_set&.to_json end |