Class: Silas::Eval::ScriptedEngine
- Inherits:
-
Adapters::Base
- Object
- Adapters::Base
- Silas::Eval::ScriptedEngine
- Defined in:
- lib/silas/eval/scripted_engine.rb
Overview
The productized FakeEngine: a pure function of context that lets an eval script the MODEL's decisions while the REAL Ledger runs the REAL tools — so assertions see a genuine transcript.
Instance Attribute Summary collapse
-
#calls ⇒ Object
readonly
Returns the value of attribute calls.
Instance Method Summary collapse
- #execute_step(context, &_on_event) ⇒ Object
-
#initialize(steps) ⇒ ScriptedEngine
constructor
A new instance of ScriptedEngine.
Constructor Details
#initialize(steps) ⇒ ScriptedEngine
Returns a new instance of ScriptedEngine.
9 10 11 12 |
# File 'lib/silas/eval/scripted_engine.rb', line 9 def initialize(steps) @steps = steps @calls = [] end |
Instance Attribute Details
#calls ⇒ Object (readonly)
Returns the value of attribute calls.
7 8 9 |
# File 'lib/silas/eval/scripted_engine.rb', line 7 def calls @calls end |
Instance Method Details
#execute_step(context, &_on_event) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/silas/eval/scripted_engine.rb', line 14 def execute_step(context, &_on_event) i = context[:index] @calls << { index: i } spec = @steps[i] return terminal("OK.") unless spec Silas::Adapters::Result.new( blocks: spec[:blocks], tool_calls: spec[:tool_calls], stop_reason: spec[:tool_calls].empty? ? "end_turn" : "tool_use", usage: { input_tokens: 10, output_tokens: 5 } ) end |