class Vellum::PromptTemplateBlockData
def self.from_json(json_object:)
-
(PromptTemplateBlockData)-
Parameters:
-
json_object(JSON) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) version = struct.version blocks = parsed_json["blocks"].map do |v| v = v.to_json PromptTemplateBlock.from_json(json_object: v) end new(version: version, blocks: blocks, additional_properties: struct) end
def self.validate_raw(obj:)
-
(Void)-
Parameters:
-
obj(Object) --
def self.validate_raw(obj:) obj.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.") obj.blocks.is_a?(Array) != false || raise("Passed value for field obj.blocks is not the expected type, validation failed.") end
def initialize(version:, blocks:, additional_properties: nil)
-
(PromptTemplateBlockData)-
Parameters:
-
additional_properties(OpenStruct) -- Additional properties unmapped to the current class definition -
blocks(Array) -- -
version(Integer) --
def initialize(version:, blocks:, additional_properties: nil) # @type [Integer] @version = version # @type [Array<PromptTemplateBlock>] @blocks = blocks # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end
def to_json(*_args)
-
(JSON)-
def to_json(*_args) { "version": @version, "blocks": @blocks }.to_json end