Class: Vellum::RejectedExecutePromptEvent
- Inherits:
-
Object
- Object
- Vellum::RejectedExecutePromptEvent
- Defined in:
- lib/vellum_ai/types/rejected_execute_prompt_event.rb
Overview
The final data returned indicating an error occurred during the stream.
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#execution_id ⇒ Object
readonly
Returns the value of attribute execution_id.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ RejectedExecutePromptEvent
Deserialize a JSON object to an instance of RejectedExecutePromptEvent.
-
.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(error:, execution_id:, meta: nil, additional_properties: nil) ⇒ RejectedExecutePromptEvent constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of RejectedExecutePromptEvent to a JSON object.
Constructor Details
#initialize(error:, execution_id:, meta: nil, additional_properties: nil) ⇒ RejectedExecutePromptEvent
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 17 def initialize(error:, execution_id:, meta: nil, additional_properties: nil) # @type [VellumError] @error = error # @type [String] @execution_id = execution_id # @type [RejectedPromptExecutionMeta] @meta = # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
10 11 12 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 10 def additional_properties @additional_properties end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
10 11 12 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 10 def error @error end |
#execution_id ⇒ Object (readonly)
Returns the value of attribute execution_id.
10 11 12 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 10 def execution_id @execution_id end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
10 11 12 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 10 def @meta end |
Class Method Details
.from_json(json_object:) ⇒ RejectedExecutePromptEvent
Deserialize a JSON object to an instance of RejectedExecutePromptEvent
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 32 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["error"].nil? error = nil else error = parsed_json["error"].to_json error = VellumError.from_json(json_object: error) end execution_id = struct.execution_id if parsed_json["meta"].nil? = nil else = parsed_json["meta"].to_json = RejectedPromptExecutionMeta.from_json(json_object: ) end new(error: error, execution_id: execution_id, meta: , 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.
62 63 64 65 66 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 62 def self.validate_raw(obj:) VellumError.validate_raw(obj: obj.error) obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.") obj..nil? || RejectedPromptExecutionMeta.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of RejectedExecutePromptEvent to a JSON object
54 55 56 |
# File 'lib/vellum_ai/types/rejected_execute_prompt_event.rb', line 54 def to_json(*_args) { "error": @error, "execution_id": @execution_id, "meta": @meta }.to_json end |