Class: LLM::Schema::Object
- Inherits:
-
Leaf
- Object
- Leaf
- LLM::Schema::Object
show all
- Defined in:
- lib/llm/schema/object.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Leaf
#const, #default, #description, #enum, #required?
Constructor Details
18
19
20
|
# File 'lib/llm/schema/object.rb', line 18
def initialize(properties)
@properties = properties
end
|
Instance Attribute Details
#properties ⇒ Hash
12
13
14
|
# File 'lib/llm/schema/object.rb', line 12
def properties
@properties
end
|
Instance Method Details
33
34
35
36
37
|
# File 'lib/llm/schema/object.rb', line 33
def merge!(other)
raise TypeError, "expected #{self.class} but got #{other.class}" unless self.class === other
@properties.merge!(other.properties)
self
end
|
#to_h ⇒ Hash
24
25
26
|
# File 'lib/llm/schema/object.rb', line 24
def to_h
super.merge!({type: "object", properties:, required:})
end
|
#to_json(options = {}) ⇒ String
41
42
43
|
# File 'lib/llm/schema/object.rb', line 41
def to_json(options = {})
to_h.to_json(options)
end
|