Files
lukaszraczyloandGitHub 4c61d19a72 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.
2026-11-25 00:40:30 +00:00

108 lines
2.1 KiB
JSON

[
{
"id": "h3-o01",
"group": "output",
"lang": "en",
"intent": "format",
"wire": "openai",
"request": {
"model": "smart/auto",
"messages": [
{
"role": "user",
"content": "extract from this and reply with ONLY valid json {\"vendor\":str,\"total\":number,\"currency\":str,\"due\":\"YYYY-MM-DD\"}:\n\nInvoice from Northwind Traders Ltd. Total due: EUR 1,284.50, payable by 3 Feb 2026. Thanks for your business!"
}
]
},
"session": null,
"minTier": 0,
"maxTier": 1,
"notes": "json extraction"
},
{
"id": "h3-o02",
"group": "output",
"lang": "en",
"intent": "format",
"wire": "openai",
"request": {
"model": "smart/auto",
"messages": [
{
"role": "user",
"content": "answer yes or no only: is 91 prime"
}
]
},
"session": null,
"minTier": 0,
"maxTier": 1,
"notes": "7*13, one word"
},
{
"id": "h3-o03",
"group": "output",
"lang": "en",
"intent": "format",
"wire": "anthropic",
"request": {
"model": "smart/auto",
"max_tokens": 4096,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "give me a markdown table comparing sqlite, postgres and mysql on: concurrency, setup effort, best for. keep cells short"
}
]
}
]
},
"session": null,
"minTier": 0,
"maxTier": 1,
"notes": "table"
},
{
"id": "h3-o04",
"group": "output",
"lang": "en",
"intent": "format",
"wire": "openai",
"request": {
"model": "smart/auto",
"messages": [
{
"role": "user",
"content": "exactly 3 bullet points, max 8 words each: why do code reviews matter"
}
]
},
"session": null,
"minTier": 0,
"maxTier": 0,
"notes": "length constraint"
},
{
"id": "h3-o05",
"group": "output",
"lang": "en",
"intent": "format",
"wire": "openai",
"request": {
"model": "smart/auto",
"messages": [
{
"role": "user",
"content": "reply with just the regex, nothing else: match ISO-8601 dates like 2026-03-07 but reject month 13 and day 32"
}
]
},
"session": null,
"minTier": 0,
"maxTier": 1,
"notes": "regex only"
}
]