Repository navigation
Re-sync Router Core to upstream 2cd5a10 - #87
Merged
Merged
Conversation
added 2 commits
October 20, 2026 10:53
Port router-core e38958b..2cd5a10 into blockrun_llm/router_core: - tokens.py (new): estimate_tokens counts CJK at ~1 token per char; scan_limit / sample_for_scan move here from strategy.py - rules.py: keywords match whole words with graded inflections (Latin/Cyrillic/Greek/digit boundary, CJK/Hangul/Arabic keep substring) - strategy.py: structured output only from requires_structured_output, never inferred from the system prompt - portfolio.py: stakes/latency/language read the user turn only; CamelCase error classes count as code; debug/code_edit with a code artifact floor at MEDIUM; stale speed fades toward 0.5; eleven probe-verified models join tool chains as priced, cost-ordered fallbacks - selector.py: an unpriced model reports 0 savings, not 100% - model_capabilities.py: regenerated from the 2026-10-20 catalog (89 models) - router.classify_by_rules defaults to estimate_tokens Tests: port the new upstream vitest cases and re-copy the decision snapshot fixture (88/88 decisions reproduce).
Merged
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.
Ports BlockRunAI/router-core
e38958b..2cd5a10intoblockrun_llm/router_core/. No version bump.Ported
tokens.py(new):estimate_tokenssizes CJK at about 1 token per char (exported).scan_limit/sample_for_scanmoved here fromstrategy.py.rules.py: keywords match whole words. Short ASCII keywords take graded inflections, digits stay exact, Cyrillic stems stay open-ended, and CJK/Hangul/Arabic keep the substring test. Upstream's\p{Script=Latin|Cyrillic|Greek}\p{N}boundary class is embedded as code-point ranges taken from Node 22 (Unicode 16).strategy.py: structured output comes only fromrequires_structured_output. A system prompt that mentions JSON or a schema no longer lifts the tier.portfolio.py: stakes, latency and language cues read only the user turn. A CamelCase error class counts as code and as a debug task. A debug or code_edit turn with a code artifact is floored at MEDIUM. A stale speed probe fades toward 0.5. The eleven tool-verified models join tool-required chains as fallbacks, only when the live catalog prices them, and cheapest first outside premium. One sharedRulesStrategyinstance, and eligibility is computed once.selector.py: a model with no price reports 0 savings.model_capabilities.py: regenerated from upstream's 2026-10-20 snapshot. It now has 89 models (+deepseek-v4.1-flash, gpt-6.1-sol, mistral-large-4, muse-glimmer-30b, laguna-s-2.1, qwen3.8-max, hy4-preview). Eleven models flip tosupports_tools=True.router.classify_by_rulesnow defaults toestimate_tokens.router_core_decisions.snapshot.jsonis re-copied from upstream.Results
pytest tests/unit: 1342 passed (Python 3.13). The CI 3.9 command gives 1105 passed, 12 skipped, 4 deselected.black --check .,ruff check .andnode scripts/sync-brand-numbers.mjs --checkare clean.