Class: AIRefactor::Prompt
- Inherits:
-
Object
- Object
- AIRefactor::Prompt
- Defined in:
- lib/ai_refactor/prompt.rb
Constant Summary collapse
- INPUT_FILE_PATH_MARKER =
"__{{input_file_path}}__"
- OUTPUT_FILE_PATH_MARKER =
"__{{output_file_path}}__"
- HEADER_MARKER =
"__{{prompt_header}}__"
- FOOTER_MARKER =
"__{{prompt_footer}}__"
- CONTEXT_MARKER =
"__{{context}}__"
- CONTENT_MARKER =
"__{{content}}__"
Instance Attribute Summary collapse
-
#input_file_path ⇒ Object
readonly
Returns the value of attribute input_file_path.
Instance Method Summary collapse
- #chat_messages ⇒ Object
-
#initialize(options:, logger:, context: nil, input_content: nil, input_path: nil, output_file_path: nil, prompt: nil, prompt_header: nil, prompt_footer: nil) ⇒ Prompt
constructor
A new instance of Prompt.
Constructor Details
#initialize(options:, logger:, context: nil, input_content: nil, input_path: nil, output_file_path: nil, prompt: nil, prompt_header: nil, prompt_footer: nil) ⇒ Prompt
Returns a new instance of Prompt.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ai_refactor/prompt.rb', line 14 def initialize(options:, logger:, context: nil, input_content: nil, input_path: nil, output_file_path: nil, prompt: nil, prompt_header: nil, prompt_footer: nil) @input_content = input_content @input_file_path = input_path @output_file_path = output_file_path @logger = logger @header = prompt_header @footer = @diff = [:diff] @context = context @prompt = prompt || raise(StandardError, "Prompt not provided") end |
Instance Attribute Details
#input_file_path ⇒ Object (readonly)
Returns the value of attribute input_file_path.
12 13 14 |
# File 'lib/ai_refactor/prompt.rb', line 12 def input_file_path @input_file_path end |
Instance Method Details
#chat_messages ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ai_refactor/prompt.rb', line 26 def [ {role: "system", content: system_prompt}, {role: "user", content: user_prompt} ] end |