Class: CleoQualityReview::PromptLoader
- Inherits:
-
Object
- Object
- CleoQualityReview::PromptLoader
- Defined in:
- lib/cleo_quality_review/prompt_loader.rb
Overview
Loads prompt templates from local or gem-bundled locations
Constant Summary collapse
- GEM_PROMPTS_DIRECTORY =
File.("../../prompts", __dir__)
- LOCAL_PROMPTS_DIRECTORY =
".cleo_quality_review"
Class Method Summary collapse
-
.load(format: "human") ⇒ String
Load a prompt template for the given format.
Instance Method Summary collapse
-
#initialize(format:) ⇒ PromptLoader
constructor
A new instance of PromptLoader.
-
#load ⇒ String
Load the prompt template.
Constructor Details
#initialize(format:) ⇒ PromptLoader
Returns a new instance of PromptLoader.
21 22 23 |
# File 'lib/cleo_quality_review/prompt_loader.rb', line 21 def initialize(format:) @format = format end |
Class Method Details
.load(format: "human") ⇒ String
Load a prompt template for the given format
15 16 17 |
# File 'lib/cleo_quality_review/prompt_loader.rb', line 15 def self.load(format: "human") new(format: format).load end |
Instance Method Details
#load ⇒ String
Load the prompt template
29 30 31 32 33 34 35 |
# File 'lib/cleo_quality_review/prompt_loader.rb', line 29 def load prompt_paths.each do |path| return File.read(path) if File.file?(path) end raise ArgumentError, "No prompt found for format #{format.inspect}" end |