Class: Vellum::CodeExecutorResponse
- Inherits:
-
Object
- Object
- Vellum::CodeExecutorResponse
- Defined in:
- lib/vellum_ai/types/code_executor_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #log ⇒ String readonly
- #output ⇒ Vellum::VellumValue readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(log:, output:, additional_properties: nil) ⇒ Vellum::CodeExecutorResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(log:, output:, additional_properties: nil) ⇒ Vellum::CodeExecutorResponse
24 25 26 27 28 29 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 24 def initialize(log:, output:, additional_properties: nil) @log = log @output = output @additional_properties = additional_properties @_field_set = { "log": log, "output": output } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
13 14 15 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 13 def additional_properties @additional_properties end |
#log ⇒ String (readonly)
9 10 11 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 9 def log @log end |
#output ⇒ Vellum::VellumValue (readonly)
11 12 13 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 11 def output @output end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::CodeExecutorResponse
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 34 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) log = parsed_json["log"] unless parsed_json["output"].nil? output = parsed_json["output"].to_json output = Vellum::VellumValue.from_json(json_object: output) else output = nil end new( log: log, output: output, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
62 63 64 65 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 62 def self.validate_raw(obj:) obj.log.is_a?(String) != false || raise("Passed value for field obj.log is not the expected type, validation failed.") Vellum::VellumValue.validate_raw(obj: obj.output) end |
Instance Method Details
#to_json ⇒ String
53 54 55 |
# File 'lib/vellum_ai/types/code_executor_response.rb', line 53 def to_json @_field_set&.to_json end |