Class: SkillBench::Task::FileReader
- Inherits:
-
Object
- Object
- SkillBench::Task::FileReader
- Defined in:
- lib/skill_bench/task/file_reader.rb
Overview
Reads task.md and criteria.json files for an evaluation task. Returns structured responses following service object contract.
Class Method Summary collapse
-
.call(full_eval_path) ⇒ Hash
Reads the task and criteria files from the given evaluation path.
Instance Method Summary collapse
-
#call ⇒ Hash
Reads task.md and criteria.json files.
-
#initialize(full_eval_path) ⇒ FileReader
constructor
A new instance of FileReader.
Constructor Details
#initialize(full_eval_path) ⇒ FileReader
Returns a new instance of FileReader.
20 21 22 |
# File 'lib/skill_bench/task/file_reader.rb', line 20 def initialize(full_eval_path) @full_eval_path = full_eval_path end |
Class Method Details
.call(full_eval_path) ⇒ Hash
Reads the task and criteria files from the given evaluation path.
15 16 17 |
# File 'lib/skill_bench/task/file_reader.rb', line 15 def self.call(full_eval_path) new(full_eval_path).call end |
Instance Method Details
#call ⇒ Hash
Reads task.md and criteria.json files.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/skill_bench/task/file_reader.rb', line 27 def call task_content = read_file('task.md') return task_content unless task_content[:success] criteria_content = read_file('criteria.json') return criteria_content unless criteria_content[:success] { success: true, response: { task: task_content[:response][:content], criteria: criteria_content[:response][:content] } } rescue StandardError => e SkillBench::ErrorLogger.log_error(e, 'Task::FileReader Error') { success: false, response: { error: { message: "Error reading task files: #{e.}" } } } end |