Class: Vellum::NodeExecutionLogBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node_definition:, message:, attributes: OMIT, severity:, additional_properties: nil) ⇒ Vellum::NodeExecutionLogBody



31
32
33
34
35
36
37
38
39
40
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 31

def initialize(node_definition:, message:, attributes: OMIT, severity:, additional_properties: nil)
  @node_definition = node_definition
  @message = message
  @attributes = attributes if attributes != OMIT
  @severity = severity
  @additional_properties = additional_properties
  @_field_set = { "node_definition": node_definition, "message": message, "attributes": attributes, "severity": severity }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)



18
19
20
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 18

def additional_properties
  @additional_properties
end

#attributes ⇒ Hash{String => Object} (readonly)



14
15
16
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 14

def attributes
  @attributes
end

#message ⇒ String (readonly)



12
13
14
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 12

def message
  @message
end

#node_definition ⇒ Vellum::VellumCodeResourceDefinition (readonly)



10
11
12
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 10

def node_definition
  @node_definition
end

#severity ⇒ Vellum::SeverityEnum (readonly)



16
17
18
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 16

def severity
  @severity
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::NodeExecutionLogBody



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 45

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["node_definition"].nil?
    node_definition = parsed_json["node_definition"].to_json
    node_definition = Vellum::VellumCodeResourceDefinition.from_json(json_object: node_definition)
  else
    node_definition = nil
  end
  message = parsed_json["message"]
  attributes = parsed_json["attributes"]
  severity = parsed_json["severity"]
  new(
    node_definition: node_definition,
    message: message,
    attributes: attributes,
    severity: severity,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void



77
78
79
80
81
82
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 77

def self.validate_raw(obj:)
  Vellum::VellumCodeResourceDefinition.validate_raw(obj: obj.node_definition)
  obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
  obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
  obj.severity.is_a?(Vellum::SeverityEnum) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String



68
69
70
# File 'lib/vellum_ai/types/node_execution_log_body.rb', line 68

def to_json
  @_field_set&.to_json
end