Module: Legion::LLM::Settings::Router

Extended by:
Legion::Logging::Helper
Defined in:
lib/legion/llm/settings/router.rb

Overview

Default settings for the Legion::LLM::Routing namespace, matched to the module nested path: a setting for Legion::LLM::Routing::Foo lives at Settings::Router.foo. Each default is its own self. method; defaults aggregates them. Wired into Settings.default as routing: once the settings.rb rewire lands.

Class Method Summary collapse

Class Method Details

.affinity_strength_bpsObject

Affinity strength (basis points, 0..10_000) applied to routing affinities when computing preference_ppm.



57
58
59
# File 'lib/legion/llm/settings/router.rb', line 57

def self.affinity_strength_bps
  10_000
end

.allow_body_routing_hintsObject

Whether an untrusted request-body model may act as a routing hint. Default-off: only trusted pins and honored hints steer selection.



75
76
77
# File 'lib/legion/llm/settings/router.rb', line 75

def self.allow_body_routing_hints
  false
end

.auto_routing_model_alias_metadataObject



30
31
32
33
34
# File 'lib/legion/llm/settings/router.rb', line 30

def self.
  {
    'copilot-utility-small' => { owned_by: 'legionio' }
  }
end

.auto_routing_model_aliasesObject



26
27
28
# File 'lib/legion/llm/settings/router.rb', line 26

def self.auto_routing_model_aliases
  %w[legionio auto copilot-utility-small]
end

.body_model_hint_blacklistObject



18
19
20
# File 'lib/legion/llm/settings/router.rb', line 18

def self.body_model_hint_blacklist
  []
end

.body_model_hint_whitelistObject



14
15
16
# File 'lib/legion/llm/settings/router.rb', line 14

def self.body_model_hint_whitelist
  []
end

.context_headroom_ppmObject

Fraction (parts-per-million) of a lane's context window the router treats as usable in the context filter. 900_000 ppm = 90%.



69
70
71
# File 'lib/legion/llm/settings/router.rb', line 69

def self.context_headroom_ppm
  900_000
end

.defaultsObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/legion/llm/settings/router.rb', line 79

def self.defaults
  {
    body_model_hint_whitelist:         body_model_hint_whitelist,
    body_model_hint_blacklist:         body_model_hint_blacklist,
    model_passthrough_ids:             model_passthrough_ids,
    auto_routing_model_aliases:        auto_routing_model_aliases,
    auto_routing_model_alias_metadata: ,
    tier_priority:                     tier_priority,
    fleet_dispatch_enabled:            fleet_dispatch_enabled,
    max_attempts:                      max_attempts,
    affinity_strength_bps:             affinity_strength_bps,
    input_framing_overhead_tokens:     input_framing_overhead_tokens,
    context_headroom_ppm:              context_headroom_ppm,
    allow_body_routing_hints:          allow_body_routing_hints
  }
end

.fleet_dispatch_enabledObject

Fleet dispatch master switch. fleet_enabled? reads this key with != false semantics (default-on); the default guarantees presence.



45
46
47
# File 'lib/legion/llm/settings/router.rb', line 45

def self.fleet_dispatch_enabled
  true
end

.input_framing_overhead_tokensObject

Conservative framing overhead (tokens) added to the byte-bound input estimate before the context filter compares against a lane's window.



63
64
65
# File 'lib/legion/llm/settings/router.rb', line 63

def self.input_framing_overhead_tokens
  1_024
end

.max_attemptsObject

Attempt budget: targets tried before EscalationExhausted. A trusted X-Legion-Max-Attempts constraint overrides this per request.



51
52
53
# File 'lib/legion/llm/settings/router.rb', line 51

def self.max_attempts
  3
end

.model_passthrough_idsObject



22
23
24
# File 'lib/legion/llm/settings/router.rb', line 22

def self.model_passthrough_ids
  %w[copilot-utility-small]
end

.tier_priorityObject

Tier selection order (highest-priority first). The Router's self.tier_priority reads this key and symbolizes it; a value always exists here so the read never needs a || fallback.



39
40
41
# File 'lib/legion/llm/settings/router.rb', line 39

def self.tier_priority
  %i[local direct fleet cloud frontier]
end