mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
feat(router): smart routers and per-member rate limits (#9)
Add smart routers: virtual models that score each request and route it to admin-defined model tiers. A retryable failure moves the request to a higher tier. The classifier v2 extracts prose, finds the original ask in long tool loops, adds an uncertainty margin and reads tool-output failures. Sessions, outcome signals, bounded calibration, adaptive selection within a tier, gated saturation downgrade, a first-byte timeout and an opt-in timeout fallback are included. Every new feature is off by default. Add per-member group limits, a tokensPerMinute window that counts uncached input and output, rate-limit headers in three dialects, soft pacing before the hard limit, and a limitExemptKinds list so embedding and reranking traffic never counts toward or hits a limit. Fix yaegi named-result state that made smartContentSize grow between calls.
This commit is contained in:
@@ -185,6 +185,20 @@ func lookupModelMetaConfig(provider, model string, cfg map[string]*ModelMetaConf
|
||||
return nil
|
||||
}
|
||||
|
||||
// modelVisionCapable reports whether (provider, model) accepts image input.
|
||||
// An unset Vision, or no modelMeta entry, counts as capable so existing
|
||||
// deployments keep today's behaviour. The exact "provider/model" key wins
|
||||
// over the bare key only when it sets Vision itself.
|
||||
func modelVisionCapable(provider, model string, cfg map[string]*ModelMetaConfig) bool {
|
||||
if v, ok := cfg[provider+"/"+model]; ok && v != nil && v.Vision != nil {
|
||||
return *v.Vision
|
||||
}
|
||||
if v, ok := cfg[model]; ok && v != nil && v.Vision != nil {
|
||||
return *v.Vision
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// resolveAliasModelMeta applies modelMeta's alias-inheritance rule
|
||||
// (feature v0.23): an alias inherits its target's fully resolved
|
||||
// metadata (resolveModelMeta against the alias's resolved provider/
|
||||
|
||||
Reference in New Issue
Block a user