Class: Intelligent::Generation
- Inherits:
-
Object
- Object
- Intelligent::Generation
- Defined in:
- lib/intelligent/generation.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#input_variables ⇒ Object
readonly
Returns the value of attribute input_variables.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#use_sequential_thinking ⇒ Object
readonly
Returns the value of attribute use_sequential_thinking.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(prompt, input_variables, llm_model, use_sequential_thinking = false, files = nil) ⇒ Generation
constructor
A new instance of Generation.
Constructor Details
#initialize(prompt, input_variables, llm_model, use_sequential_thinking = false, files = nil) ⇒ Generation
Returns a new instance of Generation.
9 10 11 12 13 14 15 16 17 |
# File 'lib/intelligent/generation.rb', line 9 def initialize(prompt, input_variables, llm_model, use_sequential_thinking = false, files = nil) @prompt = Prompt.new(prompt) @input_variables = input_variables @prompt.validate_variables!(@input_variables) @model = llm_model @use_sequential_thinking = use_sequential_thinking @files = files end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
7 8 9 |
# File 'lib/intelligent/generation.rb', line 7 def files @files end |
#input_variables ⇒ Object (readonly)
Returns the value of attribute input_variables.
7 8 9 |
# File 'lib/intelligent/generation.rb', line 7 def input_variables @input_variables end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/intelligent/generation.rb', line 7 def model @model end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
7 8 9 |
# File 'lib/intelligent/generation.rb', line 7 def prompt @prompt end |
#use_sequential_thinking ⇒ Object (readonly)
Returns the value of attribute use_sequential_thinking.
7 8 9 |
# File 'lib/intelligent/generation.rb', line 7 def use_sequential_thinking @use_sequential_thinking end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/intelligent/generation.rb', line 19 def call @generated_prompt = @prompt.process_content(@input_variables) begin return generate_with_sequential_thinking(@generated_prompt, files) if @use_sequential_thinking generate_with_llm(@generated_prompt, files) rescue => e { success: false, error: e., generated_prompt: @generated_prompt } end end |