Class: Vellum::WorkflowExecutionActualChatHistoryRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/workflow_execution_actual_chat_history_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) ⇒ WorkflowExecutionActualChatHistoryRequest

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 (Array<ChatMessageRequest>) (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



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

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 [Array<ChatMessageRequest>] 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.



8
9
10
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 8

def additional_properties
  @additional_properties
end

#desired_output_valueObject (readonly)

Returns the value of attribute desired_output_value.



8
9
10
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 8

def desired_output_value
  @desired_output_value
end

#output_idObject (readonly)

Returns the value of attribute output_id.



8
9
10
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 8

def output_id
  @output_id
end

#output_keyObject (readonly)

Returns the value of attribute output_key.



8
9
10
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 8

def output_key
  @output_key
end

#qualityObject (readonly)

Returns the value of attribute quality.



8
9
10
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 8

def quality
  @quality
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



8
9
10
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 8

def timestamp
  @timestamp
end

Class Method Details

.from_json(json_object:) ⇒ WorkflowExecutionActualChatHistoryRequest

Deserialize a JSON object to an instance of WorkflowExecutionActualChatHistoryRequest

Parameters:

  • json_object (JSON)

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  output_id = struct.output_id
  output_key = struct.output_key
  quality = struct.quality
  timestamp = struct.timestamp
  desired_output_value = parsed_json["desired_output_value"].map do |v|
    v = v.to_json
    ChatMessageRequest.from_json(json_object: v)
  end
  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)


69
70
71
72
73
74
75
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 69

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?(Array) != 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 WorkflowExecutionActualChatHistoryRequest to a JSON object

Returns:

  • (JSON)


55
56
57
58
59
60
61
62
63
# File 'lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb', line 55

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