class Vellum::GenerateStreamResultData
def self.from_json(json_object:)
-
(GenerateStreamResultData)-
Parameters:
-
json_object(JSON) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) completion_index = struct.completion_index if parsed_json["completion"].nil? completion = nil else completion = parsed_json["completion"].to_json completion = EnrichedNormalizedCompletion.from_json(json_object: completion) end new(completion_index: completion_index, completion: completion, additional_properties: struct) end
def self.validate_raw(obj:)
-
(Void)-
Parameters:
-
obj(Object) --
def self.validate_raw(obj:) obj.completion_index.is_a?(Integer) != false || raise("Passed value for field obj.completion_index is not the expected type, validation failed.") EnrichedNormalizedCompletion.validate_raw(obj: obj.completion) end
def initialize(completion_index:, completion:, additional_properties: nil)
-
(GenerateStreamResultData)-
Parameters:
-
additional_properties(OpenStruct) -- Additional properties unmapped to the current class definition -
completion(EnrichedNormalizedCompletion) -- -
completion_index(Integer) --
def initialize(completion_index:, completion:, additional_properties: nil) # @type [Integer] @completion_index = completion_index # @type [EnrichedNormalizedCompletion] @completion = completion # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end
def to_json(*_args)
-
(JSON)-
def to_json(*_args) { "completion_index": @completion_index, "completion": @completion }.to_json end