Class: Smith::Models::Normalizer
- Inherits:
-
Object
- Object
- Smith::Models::Normalizer
- Extended by:
- Dry::Initializer
- Defined in:
- lib/smith/models/normalizer.rb
Overview
Per-chat-construction request shaper. Mutates a RubyLLM::Chat in place to fit the resolved model’s capability profile, using RubyLLM’s public ‘with_*` API where it covers the case and scoped instance-variable nulling where no public API exists (RubyLLM has no `without_temperature` / `without_thinking`).
Lifetime: built fresh inside Smith::Agent.chat per construction. Never crosses threads. Never cached.
Runs OUTSIDE any workflow context — does NOT access:
- Smith.scoped_artifacts (thread-local, set only inside workflows)
- Tool.current_ledger / Tool.current_tool_result_collector
- Thread.current[:smith_last_agent_result]
Smith::Trace.record is the ONLY observability surface the normalizer touches; it’s safe outside workflow scope.
Defined Under Namespace
Classes: Decision
Class Method Summary collapse
-
.apply!(chat, profile:) ⇒ Object
Returns Array<Decision> of mutations performed.
Instance Method Summary collapse
Class Method Details
.apply!(chat, profile:) ⇒ Object
Returns Array<Decision> of mutations performed. The chat is mutated in place; callers usually ignore the return value except in tests.
38 39 40 41 42 |
# File 'lib/smith/models/normalizer.rb', line 38 def self.apply!(chat, profile:) return [] if profile.nil? new(chat: chat, profile: profile).apply! end |
Instance Method Details
#apply! ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/smith/models/normalizer.rb', line 44 def apply! @decisions = [] normalize_temperature normalize_thinking normalize_tools_routing emit_trace @decisions end |