Class: Leva::DspyRunner
Overview
Base class for runners that use DSPy.rb for LLM execution.
DspyRunner extends BaseRun to provide integration with DSPy.rb, automatically loading optimized instructions and few-shot examples from the prompt’s metadata.
Instance Method Summary collapse
-
#execute(record) ⇒ String
Executes the DSPy predictor on the given record.
Methods inherited from BaseRun
#execute_and_store, #extract_regex_pattern, #ground_truth, #merged_llm_context, #parsed_predictions, #to_llm_context
Instance Method Details
#execute(record) ⇒ String
Executes the DSPy predictor on the given record.
28 29 30 31 32 33 34 35 36 |
# File 'lib/leva/dspy_runner.rb', line 28 def execute(record) context = merged_llm_context if optimized_prompt? execute_with_optimization(context) else execute_simple(context) end end |