Class: Vapi::MessagePlan
- Inherits:
-
Object
- Object
- Vapi::MessagePlan
- Defined in:
- lib/vapi_server_sdk/types/message_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#idle_message_max_spoken_count ⇒ Float
readonly
This determines the maximum number of times ‘idleMessages` can be spoken during the call.
-
#idle_message_reset_count_on_user_speech_enabled ⇒ Boolean
readonly
This determines whether the idle message count is reset whenever the user speaks.
-
#idle_messages ⇒ Array<String>
readonly
This are the messages that the assistant will speak when the user hasn’t responded for ‘idleTimeoutSeconds`.
-
#idle_timeout_seconds ⇒ Float
readonly
This is the timeout in seconds before a message from ‘idleMessages` is spoken.
-
#silence_timeout_message ⇒ String
readonly
This is the message that the assistant will say if the call ends due to silence.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::MessagePlan
Deserialize a JSON object to an instance of MessagePlan.
-
.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(idle_messages: OMIT, idle_message_max_spoken_count: OMIT, idle_message_reset_count_on_user_speech_enabled: OMIT, idle_timeout_seconds: OMIT, silence_timeout_message: OMIT, additional_properties: nil) ⇒ Vapi::MessagePlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of MessagePlan to a JSON object.
Constructor Details
#initialize(idle_messages: OMIT, idle_message_max_spoken_count: OMIT, idle_message_reset_count_on_user_speech_enabled: OMIT, idle_timeout_seconds: OMIT, silence_timeout_message: OMIT, additional_properties: nil) ⇒ Vapi::MessagePlan
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/message_plan.rb', line 67 def initialize(idle_messages: OMIT, idle_message_max_spoken_count: OMIT, idle_message_reset_count_on_user_speech_enabled: OMIT, idle_timeout_seconds: OMIT, silence_timeout_message: OMIT, additional_properties: nil) @idle_messages = if != OMIT @idle_message_max_spoken_count = if != OMIT if != OMIT @idle_message_reset_count_on_user_speech_enabled = end @idle_timeout_seconds = idle_timeout_seconds if idle_timeout_seconds != OMIT @silence_timeout_message = if != OMIT @additional_properties = additional_properties @_field_set = { "idleMessages": , "idleMessageMaxSpokenCount": , "idleMessageResetCountOnUserSpeechEnabled": , "idleTimeoutSeconds": idle_timeout_seconds, "silenceTimeoutMessage": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
36 37 38 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 36 def additional_properties @additional_properties end |
#idle_message_max_spoken_count ⇒ Float (readonly)
Returns This determines the maximum number of times ‘idleMessages` can be spoken during the call. @default 3.
22 23 24 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 22 def @idle_message_max_spoken_count end |
#idle_message_reset_count_on_user_speech_enabled ⇒ Boolean (readonly)
Returns This determines whether the idle message count is reset whenever the user speaks. @default false.
26 27 28 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 26 def @idle_message_reset_count_on_user_speech_enabled end |
#idle_messages ⇒ Array<String> (readonly)
Returns This are the messages that the assistant will speak when the user hasn’t responded for ‘idleTimeoutSeconds`. Each time the timeout is triggered, a random message will be chosen from this array. Usage:
-
If user gets distracted and doesn’t respond for a while, this can be used to
grab their attention.
-
If the transcriber doesn’t pick up what the user said, this can be used to ask
the user to repeat themselves. (From the perspective of the assistant, the conversation is idle since it didn’t “hear” any user messages.) @default null (no idle message is spoken).
18 19 20 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 18 def @idle_messages end |
#idle_timeout_seconds ⇒ Float (readonly)
Returns This is the timeout in seconds before a message from ‘idleMessages` is spoken. The clock starts when the assistant finishes speaking and remains active until the user speaks. @default 10.
31 32 33 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 31 def idle_timeout_seconds @idle_timeout_seconds end |
#silence_timeout_message ⇒ String (readonly)
Returns This is the message that the assistant will say if the call ends due to silence. If unspecified, it will hang up without saying anything.
34 35 36 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 34 def @silence_timeout_message end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::MessagePlan
Deserialize a JSON object to an instance of MessagePlan
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 92 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["idleMessages"] = parsed_json["idleMessageMaxSpokenCount"] = parsed_json["idleMessageResetCountOnUserSpeechEnabled"] idle_timeout_seconds = parsed_json["idleTimeoutSeconds"] = parsed_json["silenceTimeoutMessage"] new( idle_messages: , idle_message_max_spoken_count: , idle_message_reset_count_on_user_speech_enabled: , idle_timeout_seconds: idle_timeout_seconds, silence_timeout_message: , 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.
123 124 125 126 127 128 129 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 123 def self.validate_raw(obj:) obj.&.is_a?(Array) != false || raise("Passed value for field obj.idle_messages is not the expected type, validation failed.") obj.&.is_a?(Float) != false || raise("Passed value for field obj.idle_message_max_spoken_count is not the expected type, validation failed.") obj.&.is_a?(Boolean) != false || raise("Passed value for field obj.idle_message_reset_count_on_user_speech_enabled is not the expected type, validation failed.") obj.idle_timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.idle_timeout_seconds is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.silence_timeout_message is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of MessagePlan to a JSON object
113 114 115 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 113 def to_json(*_args) @_field_set&.to_json end |