class Vellum::RejectedFunctionCall
Returned if the function call failed to parse for some reason.
def self.from_json(json_object:)
-
(RejectedFunctionCall)-
Parameters:
-
json_object(JSON) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["error"].nil? error = nil else error = parsed_json["error"].to_json error = VellumError.from_json(json_object: error) end id = struct.id name = struct.name new(error: error, id: id, name: name, additional_properties: struct) end
def self.validate_raw(obj:)
-
(Void)-
Parameters:
-
obj(Object) --
def self.validate_raw(obj:) VellumError.validate_raw(obj: obj.error) 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.") end
def initialize(error:, name:, id: nil, additional_properties: nil)
-
(RejectedFunctionCall)-
Parameters:
-
additional_properties(OpenStruct) -- Additional properties unmapped to the current class definition -
name(String) -- -
id(String) -- -
error(VellumError) --
def initialize(error:, name:, id: nil, additional_properties: nil) # @type [VellumError] @error = error # @type [String] @id = id # @type [String] @name = name # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end
def to_json(*_args)
-
(JSON)-
def to_json(*_args) { "error": @error, "id": @id, "name": @name }.to_json end