fix(quick-router): route "how much is" arithmetic to the calculator - #871
Conversation
The arithmetic lead-in strip set accepted "what is"/"calculate" but not "how much is", so "how much is 45 times 6" kept its question words, failed the all-math-chars gate, and fell through to the LLM — even though "how much is 20% of 50" already routes (percentage_expression strips no lead-in). Add the lead-in so arithmetic behind it routes to calculate like the others.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe arithmetic router recognizes ChangesArithmetic routing
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
matedev01
left a comment
There was a problem hiding this comment.
LGTM — arithmetic_expression stripped 'calculate '/'what is ' lead-ins but not 'how much is', so that phrasing kept its question words and failed the all-math-chars gate. Verified: clippy -D warnings clean, calc/quick-router tests (130) pass, fmt clean, live BFCL strict_accuracy 96.15% (no regression).
Summary
arithmetic_expressionstrips thecalculate/what islead-ins before the all-math-chars gate, but nothow much is— so arithmetic behind that lead-in keeps its question words, fails the gate, and falls through to the LLM. This is inconsistent:how much is 20% of 50already routes today, becausepercentage_expressionruns first and strips no lead-in.mainhow much is 45 times 6calculate{45 * 6}how much is 100 divided by 4calculate{100 / 4}how much is 2 plus 2calculate{2 + 2}The
what is/calculateforms already resolve today.Changes
how much isto the lead-in strip chain inarithmetic_expression, mirroring the existingwhat is/calculateentries.how much is a ticket(no digit) andhow much is 5 dollars in euros(no operator) still abstain;how much is 20% of 50stays on the earlier percentage path.routes_how_much_is_arithmetic_to_calculate(three phrasings: times / divided by / plus).Real Behavior Proof
Tested profile / hardware (check all that apply):
jetsonraspberry_piportable_sbclaptopmacRan
cargo test -p genie-core --no-default-features --lib tools::quick(108 passed) and--test calc_input_test(13 passed); the newroutes_how_much_is_arithmetic_to_calculatetest fails onmain(all three utterances route toNone→ panic) and passes with the change.cargo clippyandcargo fmt --checkare clean. The change is pure text-classification logic with no hardware dependency, so the laptop run exercises the full affected path.Summary by CodeRabbit
Bug Fixes
Tests