Class: Vellum::WorkflowResultEventOutputDataSearchResults
- Inherits:
-
Object
- Object
- Vellum::WorkflowResultEventOutputDataSearchResults
- Defined in:
- lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb
Overview
A Search Results output streamed from a Workflow execution.
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#delta ⇒ Object
readonly
Returns the value of attribute delta.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node_id ⇒ Object
readonly
Returns the value of attribute node_id.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ WorkflowResultEventOutputDataSearchResults
Deserialize a JSON object to an instance of WorkflowResultEventOutputDataSearchResults.
-
.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(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil) ⇒ WorkflowResultEventOutputDataSearchResults constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of WorkflowResultEventOutputDataSearchResults to a JSON object.
Constructor Details
#initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil) ⇒ WorkflowResultEventOutputDataSearchResults
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 20 def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil) # @type [String] @id = id # @type [String] @name = name # @type [WORKFLOW_NODE_RESULT_EVENT_STATE] @state = state # @type [String] @node_id = node_id # @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING. @delta = delta # @type [Array<SearchResult>] @value = value # @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/workflow_result_event_output_data_search_results.rb', line 10 def additional_properties @additional_properties end |
#delta ⇒ Object (readonly)
Returns the value of attribute delta.
10 11 12 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 10 def delta @delta end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 10 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 10 def name @name end |
#node_id ⇒ Object (readonly)
Returns the value of attribute node_id.
10 11 12 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 10 def node_id @node_id end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
10 11 12 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 10 def state @state end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 10 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ WorkflowResultEventOutputDataSearchResults
Deserialize a JSON object to an instance of WorkflowResultEventOutputDataSearchResults
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id name = struct.name state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"] node_id = struct.node_id delta = struct.delta value = parsed_json["value"].map do |v| v = v.to_json SearchResult.from_json(json_object: v) end new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, 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.
74 75 76 77 78 79 80 81 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 74 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.") obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.") obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of WorkflowResultEventOutputDataSearchResults to a JSON object
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb', line 59 def to_json(*_args) { "id": @id, "name": @name, "state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state, "node_id": @node_id, "delta": @delta, "value": @value }.to_json end |