Class: Vellum::FulfilledExecutePromptEvent
- Inherits:
-
Object
- Object
- Vellum::FulfilledExecutePromptEvent
- Defined in:
- lib/vellum_ai/types/fulfilled_execute_prompt_event.rb
Overview
The final data event returned indicating that the stream has ended and all final resolved values from the model can be found.
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#execution_id ⇒ Object
readonly
Returns the value of attribute execution_id.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ FulfilledExecutePromptEvent
Deserialize a JSON object to an instance of FulfilledExecutePromptEvent.
-
.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(outputs:, execution_id:, meta: nil, additional_properties: nil) ⇒ FulfilledExecutePromptEvent constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of FulfilledExecutePromptEvent to a JSON object.
Constructor Details
#initialize(outputs:, execution_id:, meta: nil, additional_properties: nil) ⇒ FulfilledExecutePromptEvent
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 17 def initialize(outputs:, execution_id:, meta: nil, additional_properties: nil) # @type [Array<PromptOutput>] @outputs = outputs # @type [String] @execution_id = execution_id # @type [FulfilledPromptExecutionMeta] @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/fulfilled_execute_prompt_event.rb', line 10 def additional_properties @additional_properties end |
#execution_id ⇒ Object (readonly)
Returns the value of attribute execution_id.
10 11 12 |
# File 'lib/vellum_ai/types/fulfilled_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/fulfilled_execute_prompt_event.rb', line 10 def @meta end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
10 11 12 |
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 10 def outputs @outputs end |
Class Method Details
.from_json(json_object:) ⇒ FulfilledExecutePromptEvent
Deserialize a JSON object to an instance of FulfilledExecutePromptEvent
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vellum_ai/types/fulfilled_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) outputs = parsed_json["outputs"].map do |v| v = v.to_json PromptOutput.from_json(json_object: v) end execution_id = struct.execution_id if parsed_json["meta"].nil? = nil else = parsed_json["meta"].to_json = FulfilledPromptExecutionMeta.from_json(json_object: ) end new(outputs: outputs, 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.
60 61 62 63 64 |
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 60 def self.validate_raw(obj:) obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.") obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.") obj..nil? || FulfilledPromptExecutionMeta.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of FulfilledExecutePromptEvent to a JSON object
52 53 54 |
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 52 def to_json(*_args) { "outputs": @outputs, "execution_id": @execution_id, "meta": @meta }.to_json end |