Class: RubyLLM::Contract::Prompt::Nodes::SectionNode

Inherits:
RubyLLM::Contract::Prompt::Node show all
Defined in:
lib/ruby_llm/contract/prompt/nodes/section_node.rb

Instance Attribute Summary collapse

Attributes inherited from RubyLLM::Contract::Prompt::Node

#content, #type

Instance Method Summary collapse

Constructor Details

#initialize(name, content) ⇒ SectionNode

Returns a new instance of SectionNode.



10
11
12
13
# File 'lib/ruby_llm/contract/prompt/nodes/section_node.rb', line 10

def initialize(name, content)
  @name = name.freeze
  super(type: :section, content: content)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/ruby_llm/contract/prompt/nodes/section_node.rb', line 8

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/ruby_llm/contract/prompt/nodes/section_node.rb', line 15

def ==(other)
  other.is_a?(self.class) && type == other.type && name == other.name && content == other.content
end

#to_hObject



19
20
21
# File 'lib/ruby_llm/contract/prompt/nodes/section_node.rb', line 19

def to_h
  { type: :section, name: @name, content: @content }
end