Module: Structify::Model::ClassMethods

Defined in:
lib/structify/model.rb

Overview

Class methods added to the including class

Instance Method Summary collapse

Instance Method Details

#extraction_versionInteger

Get the current extraction version

Returns:

  • (Integer)

    The version number



103
104
105
# File 'lib/structify/model.rb', line 103

def extraction_version
  schema_builder&.version_number
end

#json_schemaHash

Get the JSON schema representation

Returns:

  • (Hash)

    The JSON schema



96
97
98
# File 'lib/structify/model.rb', line 96

def json_schema
  schema_builder&.to_json_schema
end

#schema_definition {|void| ... } ⇒ void

This method returns an undefined value.

Define the schema for LLM extraction

Yields:

  • (void)

    The schema definition block



88
89
90
91
# File 'lib/structify/model.rb', line 88

def schema_definition(&block)
  self.schema_builder ||= SchemaBuilder.new(self)
  schema_builder.instance_eval(&block) if block_given?
end