Class: Vapi::ToolMessageFailed
- Inherits:
-
Object
- Object
- Vapi::ToolMessageFailed
- Defined in:
- lib/vapi_server_sdk/types/tool_message_failed.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#conditions ⇒ Array<Vapi::Condition>
readonly
This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered.
-
#content ⇒ String
readonly
This is the content that the assistant says when this message is triggered.
-
#contents ⇒ Array<Vapi::TextContent>
readonly
This is an alternative to the ‘content` property.
-
#end_call_after_spoken_enabled ⇒ Boolean
readonly
This is an optional boolean that if true, the call will end after the message is spoken.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ToolMessageFailed
Deserialize a JSON object to an instance of ToolMessageFailed.
-
.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(contents: OMIT, end_call_after_spoken_enabled: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil) ⇒ Vapi::ToolMessageFailed constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ToolMessageFailed to a JSON object.
Constructor Details
#initialize(contents: OMIT, end_call_after_spoken_enabled: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil) ⇒ Vapi::ToolMessageFailed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 52 def initialize(contents: OMIT, end_call_after_spoken_enabled: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil) @contents = contents if contents != OMIT @end_call_after_spoken_enabled = end_call_after_spoken_enabled if end_call_after_spoken_enabled != OMIT @content = content if content != OMIT @conditions = conditions if conditions != OMIT @additional_properties = additional_properties @_field_set = { "contents": contents, "endCallAfterSpokenEnabled": end_call_after_spoken_enabled, "content": content, "conditions": conditions }.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/tool_message_failed.rb', line 29 def additional_properties @additional_properties end |
#conditions ⇒ Array<Vapi::Condition> (readonly)
Returns This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered.
27 28 29 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 27 def conditions @conditions end |
#content ⇒ String (readonly)
Returns This is the content that the assistant says when this message is triggered.
24 25 26 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 24 def content @content end |
#contents ⇒ Array<Vapi::TextContent> (readonly)
Returns This is an alternative to the ‘content` property. It allows to specify variants of the same content, one per language. Usage:
-
If your assistants are multilingual, you can provide content for each
language.
-
If you don’t provide content for a language, the first item in the array will
be automatically translated to the active language at that moment. This will override the ‘content` property.
18 19 20 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 18 def contents @contents end |
#end_call_after_spoken_enabled ⇒ Boolean (readonly)
Returns This is an optional boolean that if true, the call will end after the message is spoken. Default is false. @default false.
22 23 24 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 22 def end_call_after_spoken_enabled @end_call_after_spoken_enabled end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ToolMessageFailed
Deserialize a JSON object to an instance of ToolMessageFailed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 73 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) contents = parsed_json["contents"]&.map do |item| item = item.to_json Vapi::TextContent.from_json(json_object: item) end end_call_after_spoken_enabled = parsed_json["endCallAfterSpokenEnabled"] content = parsed_json["content"] conditions = parsed_json["conditions"]&.map do |item| item = item.to_json Vapi::Condition.from_json(json_object: item) end new( contents: contents, end_call_after_spoken_enabled: end_call_after_spoken_enabled, content: content, conditions: conditions, 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.
108 109 110 111 112 113 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 108 def self.validate_raw(obj:) obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.") obj.end_call_after_spoken_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.end_call_after_spoken_enabled is not the expected type, validation failed.") obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ToolMessageFailed to a JSON object
98 99 100 |
# File 'lib/vapi_server_sdk/types/tool_message_failed.rb', line 98 def to_json(*_args) @_field_set&.to_json end |