Class: Appydave::Tools::PromptTools::PromptCompletion
- Inherits:
-
Object
- Object
- Appydave::Tools::PromptTools::PromptCompletion
- Includes:
- KLog::Logging
- Defined in:
- lib/appydave/tools/prompt_tools/prompt_completion.rb
Overview
PromptCompletion is a class for running a completion prompt against the model
Instance Attribute Summary collapse
-
#clipboard ⇒ Object
readonly
Returns the value of attribute clipboard.
-
#expanded_prompt ⇒ Object
readonly
Returns the value of attribute expanded_prompt.
-
#llm ⇒ Object
readonly
Returns the value of attribute llm.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#placeholders ⇒ Object
readonly
Returns the value of attribute placeholders.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#prompt_file ⇒ Object
readonly
Returns the value of attribute prompt_file.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PromptCompletion
constructor
A new instance of PromptCompletion.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ PromptCompletion
Returns a new instance of PromptCompletion.
18 19 20 21 22 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 18 def initialize( = {}) () end |
Instance Attribute Details
#clipboard ⇒ Object (readonly)
Returns the value of attribute clipboard.
16 17 18 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 16 def clipboard @clipboard end |
#expanded_prompt ⇒ Object (readonly)
Returns the value of attribute expanded_prompt.
12 13 14 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 12 def @expanded_prompt end |
#llm ⇒ Object (readonly)
Returns the value of attribute llm.
13 14 15 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 13 def llm @llm end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
15 16 17 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 15 def output_file @output_file end |
#placeholders ⇒ Object (readonly)
Returns the value of attribute placeholders.
14 15 16 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 14 def placeholders @placeholders end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
10 11 12 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 10 def prompt @prompt end |
#prompt_file ⇒ Object (readonly)
Returns the value of attribute prompt_file.
11 12 13 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 11 def prompt_file @prompt_file end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/appydave/tools/prompt_tools/prompt_completion.rb', line 24 def run result = run_prompt() log.subheading 'Expanded Prompt' puts log.subheading 'Result' puts result if output_file File.write(output_file, result) puts "Output written to #{output_file}" end if clipboard Clipboard.copy(result) puts 'Output copied to clipboard' end puts result unless output_file end |