Class: Silas::Eval::ScriptedEngine
- Inherits:
-
Silas::Engines::Base
- Object
- Silas::Engines::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.
Class Method Summary collapse
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.
11 12 13 14 |
# File 'lib/silas/eval/scripted_engine.rb', line 11 def initialize(steps) @steps = steps @calls = [] end |
Instance Attribute Details
#calls ⇒ Object (readonly)
Returns the value of attribute calls.
9 10 11 |
# File 'lib/silas/eval/scripted_engine.rb', line 9 def calls @calls end |
Class Method Details
.loop_ownership ⇒ Object
7 |
# File 'lib/silas/eval/scripted_engine.rb', line 7 def self.loop_ownership = :framework |
Instance Method Details
#execute_step(context, &_on_event) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/silas/eval/scripted_engine.rb', line 16 def execute_step(context, &_on_event) i = context[:index] @calls << { index: i } spec = @steps[i] return terminal("OK.") unless spec Silas::Engines::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 |