feat: capability and signal-aware routing#973
Open
Spherrrical wants to merge 1 commit into
Open
Conversation
Adds a two-tier routing-signal surface. Tier 1 hard capability filters (modality + context-window fit) prune models that cannot serve a request; capabilities are fetched at runtime from models.dev (like cost/latency metrics, no committed snapshot) with user-config overrides. Tier 2 ranks the capable pool by internal long-context-quality scores. Includes vision-input routing, /v1/images/generations and /v1/audio/speech (binary passthrough), empty_pool_behavior hard gate, tier-attributed telemetry, per-modality fastest groundwork, schema + docs presets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a two-tier routing-signal surface to Plano so the router can serve multimodal requests and route on richer signals, while keeping the Plano-Orchestrator text-blind.
/v1/images/generations,/v1/audio/speech, context-window fit). Capabilities are fetched at runtime from models.dev — the same pattern as DigitalOcean cost / Prometheus latency, no committed snapshot — with optional per-modelcapabilities:overrides in config. Precedence:user config > models.dev > conservative default.long_context_qualityscore (separate from capabilities; not user-authored).empty_pool_behavior(errordefault → 422 /warning→ proceed) is the only lever that letsrouting_preferenceswin over a capability filter.What's included
RequiredCapabilitiesfrom request shape +has_vision()/required_context_tokens()onProviderRequest; intersection filter indetermine_route()before ranking, plus no-match-path validation.ModelCapabilitiesService(brightstaff) mirroringModelMetricsService: runtime fetch + optional refresh loop, empty-on-failure.long_context_qualityselection policy; internallong_context_quality.yamldataset with provenance.llm_gateway(no JSON mangling/token accounting foraudio/*etc.).fastestgroundwork (latency keyed by(model, modality), cold-start seeding).plano_config_schema.yaml(capabilitiesblock,long_context_quality,overrides.empty_pool_behavior,overrides.model_capabilities_source), config-generator passthrough + tests, and vision/long-context/image/TTS presets in the config reference docs.Notes for reviewers
empty_pool_behavior: errorthat can 422 a multimodal request. Pin with an explicitcapabilities:block to guarantee offline behavior.SupportedAPIsFromClientmapping so they aren't misparsed as chat; capability filtering keys off the endpoint path. Full client-side request transforms are a follow-up.Test plan
cargo fmt --all -- --checkcargo clippy -p common -p hermesllm -p brightstaff --all-targets -- -D warnings(+ clippy on thewasm32-wasip1llm_gatewaytarget)cargo test --libforcommon(39),hermesllm(167),brightstaff(171),llm_gateway(6)llm_gateway,prompt_gateway) + verified the capabilities blob is no longer embeddedpytest test/test_config_generator.py(27, incl. new schema cases); full-reference config validates against the schemaempty_pool_behaviorsemantics against expectations