Repository navigation
feat(router): opt-in session affinity for complexity router #33126
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 1 commit
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 |
|---|---|---|
|
|
@@ -361,6 +361,20 @@ class ComplexityRouterConfig(BaseModel): | |
| description="Minimum cosine similarity for a semantic keyword match", | ||
| ) | ||
|
|
||
| # Session affinity: pin the first turn's routed model for the rest of the session | ||
| session_affinity: bool = Field( | ||
| default=False, | ||
| description=( | ||
| "When True and a session_id is resolvable on the request, pin the model chosen on the " | ||
| "session's first turn and reuse it for every later turn, skipping re-classification." | ||
| ), | ||
| ) | ||
| session_affinity_ttl_seconds: int = Field( | ||
| default=3600, | ||
| gt=0, | ||
| description="TTL for the session affinity pin; refreshed on every cache hit", | ||
| ) | ||
|
Comment on lines
+372
to
+376
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.
The |
||
|
|
||
| model_config = ConfigDict(extra="allow") # Allow additional fields | ||
|
|
||
| @field_validator("tiers", mode="before") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.