Module: OmniAI::Schema
- Defined in:
- lib/omniai/schema.rb,
lib/omniai/schema/base.rb,
lib/omniai/schema/array.rb,
lib/omniai/schema/format.rb,
lib/omniai/schema/object.rb,
lib/omniai/schema/scalar.rb
Overview
Defined Under Namespace
Classes: Array, Base, Format, Object, Scalar
Class Method Summary
collapse
-
.array(items:, min_items: nil, max_items: nil, description: nil, nullable: nil) ⇒ OmniAI::Schema::Array
-
.boolean(title: nil, description: nil, enum: nil, nullable: nil) ⇒ OmniAI::Schema::Scalar
-
.build(kind, **args) ⇒ OmniAI::Schema::Object, ...
-
.deserialize(data) ⇒ Object
-
.format(name:, schema:) ⇒ OmniAI::Schema::Format
-
.integer(title: nil, description: nil, enum: nil, nullable: nil) ⇒ OmniAI::Schema::Scalar
-
.number(title: nil, description: nil, enum: nil, nullable: nil) ⇒ OmniAI::Schema::Scalar
-
.object(title: nil, properties: {}, required: [], description: nil, nullable: nil) ⇒ OmniAI::Schema::Array
-
.string(title: nil, description: nil, enum: nil, nullable: nil) ⇒ OmniAI::Schema::Scalar
Class Method Details
.array(items:, min_items: nil, max_items: nil, description: nil, nullable: nil) ⇒ OmniAI::Schema::Array
88
89
90
|
# File 'lib/omniai/schema.rb', line 88
def self.array(items:, min_items: nil, max_items: nil, description: nil, nullable: nil)
OmniAI::Schema::Array.new(items:, description:, min_items:, max_items:, nullable:)
end
|
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/omniai/schema.rb', line 62
def self.build(kind, **args)
case kind
when :array then array(**args)
when :object then object(**args)
when :boolean then boolean(**args)
when :integer then integer(**args)
when :number then number(**args)
when :string then string(**args)
end
end
|
174
175
176
|
# File 'lib/omniai/schema.rb', line 174
def self.format(name:, schema:)
OmniAI::Schema::Format.new(name:, schema:)
end
|
.object(title: nil, properties: {}, required: [], description: nil, nullable: nil) ⇒ OmniAI::Schema::Array
110
111
112
|
# File 'lib/omniai/schema.rb', line 110
def self.object(title: nil, properties: {}, required: [], description: nil, nullable: nil)
OmniAI::Schema::Object.new(title:, properties:, required:, description:, nullable:)
end
|