-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
feat(proxy): serve the auto-router preset catalog at runtime #39412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| from collections.abc import Mapping | ||
| from collections.abc import Mapping, Sequence | ||
| from typing import Any, Literal | ||
|
|
||
| from pydantic import BaseModel | ||
| from pydantic import BaseModel, ConfigDict | ||
|
|
||
|
|
||
| class PublicModelHubInfo(BaseModel): | ||
|
|
@@ -73,6 +73,44 @@ class SupportedEndpointsResponse(BaseModel): | |
| endpoints: list[SupportedEndpoint] | ||
|
|
||
|
|
||
| class AutoRouterPresetTiers(BaseModel): | ||
| """Exactly the four built-in tiers the dashboard's preset prefill can apply. | ||
|
|
||
| extra="forbid" on purpose: a tier name this dashboard cannot apply would grey out or crash the | ||
| picker, so such a catalog is rejected wholesale and the bundled one serves instead. | ||
| """ | ||
|
|
||
| model_config = ConfigDict(extra="forbid") | ||
|
|
||
| SIMPLE: Sequence[str] | ||
| MEDIUM: Sequence[str] | ||
| COMPLEX: Sequence[str] | ||
| REASONING: Sequence[str] | ||
|
|
||
|
|
||
| class AutoRouterPresetConfig(BaseModel): | ||
| """The complexity_router_config a preset prefills. | ||
|
|
||
| Only tiers is validated, because every dashboard consumer dereferences it; everything else | ||
| passes through verbatim with unknown fields kept (extra="allow"), so a catalog published after | ||
| this proxy shipped still serves its new fields intact. | ||
| """ | ||
|
|
||
| model_config = ConfigDict(extra="allow") | ||
|
|
||
| tiers: AutoRouterPresetTiers | ||
|
|
||
|
|
||
| class AutoRouterPresetRecord(BaseModel): | ||
| """One auto-router preset as served to the dashboard's template picker.""" | ||
|
|
||
| model_config = ConfigDict(extra="allow") | ||
|
|
||
| label: str | ||
| description: str | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a remote or overridden catalog contains an envelope-valid preset with missing or malformed tiers, this mapping accepts it and the dashboard later calls Knowledge Base Used: Dashboard and enterprise UI
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 5af5e21: tiers is now validated per preset, so a malformed catalog rejects and the bundled one serves; pinned by adapter tests |
||
| complexity_router_config: AutoRouterPresetConfig | ||
|
|
||
|
|
||
| class ComplexityScorerDefaults(BaseModel): | ||
| """The complexity router's shipped heuristic scorer defaults. | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.