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
idleMessagescan be spoken during the call. -
#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
idleMessagesis spoken.
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_timeout_seconds: 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_timeout_seconds: OMIT, additional_properties: nil) ⇒ Vapi::MessagePlan
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 55 def initialize(idle_messages: OMIT, idle_message_max_spoken_count: OMIT, idle_timeout_seconds: OMIT, additional_properties: nil) @idle_messages = if != OMIT @idle_message_max_spoken_count = if != OMIT @idle_timeout_seconds = idle_timeout_seconds if idle_timeout_seconds != OMIT @additional_properties = additional_properties @_field_set = { "idleMessages": , "idleMessageMaxSpokenCount": , "idleTimeoutSeconds": idle_timeout_seconds }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
29 30 31 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 29 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_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.
27 28 29 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 27 def idle_timeout_seconds @idle_timeout_seconds end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::MessagePlan
Deserialize a JSON object to an instance of MessagePlan
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 74 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"] idle_timeout_seconds = parsed_json["idleTimeoutSeconds"] new( idle_messages: , idle_message_max_spoken_count: , idle_timeout_seconds: idle_timeout_seconds, 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.
101 102 103 104 105 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 101 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.idle_timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.idle_timeout_seconds is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of MessagePlan to a JSON object
91 92 93 |
# File 'lib/vapi_server_sdk/types/message_plan.rb', line 91 def to_json(*_args) @_field_set&.to_json end |