LemonRouter. ModelSelection
(lemon_router v0.1.0)
View Source
Resolves model + engine selection independently from profile binding.
This module keeps profile defaults useful (engine, system prompt, tool policy) while allowing model selection to be overridden at request/session layers.
Precedence (highest to lowest):
- model: request-level explicit model -> meta model -> session model -> profile model -> history model -> router default model
- engine: resume engine -> explicit engine_id -> model-implied engine -> profile default engine
The history_model slot is populated by the router when the routing_feedback
feature flag is enabled and sufficient historical performance data exists for the
task context. It acts as a soft tie-breaker between the profile default and the
router fallback — it never overrides explicit user intent.
If an explicit engine_id conflicts with a model-implied engine, we keep the
explicit engine (caller intent wins) and emit a warning.