Class: RubyLLM::Contract::Prompt::Nodes::ExampleNode
- Inherits:
-
RubyLLM::Contract::Prompt::Node
- Object
- RubyLLM::Contract::Prompt::Node
- RubyLLM::Contract::Prompt::Nodes::ExampleNode
- Defined in:
- lib/ruby_llm/contract/prompt/nodes/example_node.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Attributes inherited from RubyLLM::Contract::Prompt::Node
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(input:, output:) ⇒ ExampleNode
constructor
A new instance of ExampleNode.
- #to_h ⇒ Object
Constructor Details
#initialize(input:, output:) ⇒ ExampleNode
Returns a new instance of ExampleNode.
10 11 12 13 14 |
# File 'lib/ruby_llm/contract/prompt/nodes/example_node.rb', line 10 def initialize(input:, output:) @input = input.frozen? ? input : input.dup.freeze @output = output.frozen? ? output : output.dup.freeze super(type: :example, content: nil) end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
8 9 10 |
# File 'lib/ruby_llm/contract/prompt/nodes/example_node.rb', line 8 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
8 9 10 |
# File 'lib/ruby_llm/contract/prompt/nodes/example_node.rb', line 8 def output @output end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/ruby_llm/contract/prompt/nodes/example_node.rb', line 16 def ==(other) other.is_a?(self.class) && type == other.type && input == other.input && output == other.output end |
#to_h ⇒ Object
20 21 22 |
# File 'lib/ruby_llm/contract/prompt/nodes/example_node.rb', line 20 def to_h { type: :example, input: @input, output: @output } end |