Class: Vellum::WorkflowExecutionActualJsonRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/workflow_execution_actual_json_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_id: nil, output_key: nil, quality: nil, timestamp: nil, desired_output_value: nil, additional_properties: nil) ⇒ WorkflowExecutionActualJsonRequest

Parameters:

  • output_id (String) (defaults to: nil)

    The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.

  • output_key (String) (defaults to: nil)

    The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the ‘Name` specified in a Final Output Node. Generally preferred over output_id.

  • quality (Float) (defaults to: nil)

    Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.

  • timestamp (Float) (defaults to: nil)

    Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.

  • desired_output_value (Hash{String => String}) (defaults to: nil)

    Optionally provide the value that the output ideally should have been.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 16

def initialize(output_id: nil, output_key: nil, quality: nil, timestamp: nil, desired_output_value: nil,
               additional_properties: nil)
  # @type [String] The Vellum-generated ID of a workflow output. Must provide either this or output_key. output_key is typically preferred.
  @output_id = output_id
  # @type [String] The user-defined name of a workflow output. Must provide either this or output_id. Should correspond to the `Name` specified in a Final Output Node. Generally preferred over output_id.
  @output_key = output_key
  # @type [Float] Optionally provide a decimal number between 0.0 and 1.0 (inclusive) representing the quality of the output. 0 is the worst, 1 is the best.
  @quality = quality
  # @type [Float] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
  @timestamp = timestamp
  # @type [Hash{String => String}] Optionally provide the value that the output ideally should have been.
  @desired_output_value = desired_output_value
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



7
8
9
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 7

def additional_properties
  @additional_properties
end

#desired_output_valueObject (readonly)

Returns the value of attribute desired_output_value.



7
8
9
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 7

def desired_output_value
  @desired_output_value
end

#output_idObject (readonly)

Returns the value of attribute output_id.



7
8
9
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 7

def output_id
  @output_id
end

#output_keyObject (readonly)

Returns the value of attribute output_key.



7
8
9
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 7

def output_key
  @output_key
end

#qualityObject (readonly)

Returns the value of attribute quality.



7
8
9
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 7

def quality
  @quality
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



7
8
9
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 7

def timestamp
  @timestamp
end

Class Method Details

.from_json(json_object:) ⇒ WorkflowExecutionActualJsonRequest

Deserialize a JSON object to an instance of WorkflowExecutionActualJsonRequest

Parameters:

  • json_object (JSON)

Returns:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  JSON.parse(json_object)
  output_id = struct.output_id
  output_key = struct.output_key
  quality = struct.quality
  timestamp = struct.timestamp
  desired_output_value = struct.desired_output_value
  new(output_id: output_id, output_key: output_key, quality: quality, timestamp: timestamp,
      desired_output_value: desired_output_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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


65
66
67
68
69
70
71
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 65

def self.validate_raw(obj:)
  obj.output_id&.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.")
  obj.output_key&.is_a?(String) != false || raise("Passed value for field obj.output_key is not the expected type, validation failed.")
  obj.quality&.is_a?(Float) != false || raise("Passed value for field obj.quality is not the expected type, validation failed.")
  obj.timestamp&.is_a?(Float) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
  obj.desired_output_value&.is_a?(Hash) != false || raise("Passed value for field obj.desired_output_value is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of WorkflowExecutionActualJsonRequest to a JSON object

Returns:

  • (JSON)


51
52
53
54
55
56
57
58
59
# File 'lib/vellum_ai/types/workflow_execution_actual_json_request.rb', line 51

def to_json(*_args)
  {
    "output_id": @output_id,
    "output_key": @output_key,
    "quality": @quality,
    "timestamp": @timestamp,
    "desired_output_value": @desired_output_value
  }.to_json
end