Class: RubyLLM::Contract::Prompt::Node
- Inherits:
-
Object
- Object
- RubyLLM::Contract::Prompt::Node
- Defined in:
- lib/ruby_llm/contract/prompt/node.rb
Direct Known Subclasses
RubyLLM::Contract::Prompt::Nodes::ExampleNode, RubyLLM::Contract::Prompt::Nodes::RuleNode, RubyLLM::Contract::Prompt::Nodes::SectionNode, RubyLLM::Contract::Prompt::Nodes::SystemNode, RubyLLM::Contract::Prompt::Nodes::UserNode
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type:, content:) ⇒ Node
constructor
A new instance of Node.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, content:) ⇒ Node
Returns a new instance of Node.
9 10 11 12 13 |
# File 'lib/ruby_llm/contract/prompt/node.rb', line 9 def initialize(type:, content:) @type = type @content = content.frozen? ? content : content.dup.freeze freeze end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/ruby_llm/contract/prompt/node.rb', line 7 def content @content end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/ruby_llm/contract/prompt/node.rb', line 7 def type @type end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 |
# File 'lib/ruby_llm/contract/prompt/node.rb', line 15 def ==(other) other.is_a?(self.class) && type == other.type && content == other.content end |
#to_h ⇒ Object
19 20 21 |
# File 'lib/ruby_llm/contract/prompt/node.rb', line 19 def to_h { type: @type, content: @content } end |