Module: Leva::ApplicationHelper
- Included in:
- ExperimentsController, WorkbenchController
- Defined in:
- app/helpers/leva/application_helper.rb
Instance Method Summary collapse
-
#load_evaluators ⇒ Array<Class>
Loads all evaluator classes that inherit from Leva::BaseEval.
-
#load_predefined_prompts ⇒ Array<Array<String, String>>
Loads predefined prompts from markdown files.
-
#load_runners ⇒ Array<Class>
Loads all runner classes that inherit from Leva::BaseRun.
Instance Method Details
#load_evaluators ⇒ Array<Class>
Loads all evaluator classes that inherit from Leva::BaseEval
6 7 8 |
# File 'app/helpers/leva/application_helper.rb', line 6 def load_evaluators load_classes_from_directory('app/evals', Leva::BaseEval) || [] end |
#load_predefined_prompts ⇒ Array<Array<String, String>>
Loads predefined prompts from markdown files
20 21 22 23 24 25 26 27 |
# File 'app/helpers/leva/application_helper.rb', line 20 def load_predefined_prompts prompts = Dir.glob(Rails.root.join('app', 'prompts', '*.md')).map do |file| name = File.basename(file, '.md').titleize content = File.read(file) [name, content] end prompts end |