fix(quick-router): keep the city when a weather query ends "in the morning"#628
Conversation
…rning"
extract_location_after_marker splits the location off with the last " in "
in the utterance, so a trailing "in the morning/afternoon/evening/night"
phrase won the split and discarded the city: "what's the weather in Denver
in the morning?" routed to get_weather{location: "morning"} and geocoded the
wrong place.
Strip that trailing time-of-day phrase before the marker split so the city
survives. Forecast detection reads the whole utterance, so it is unchanged.
The GeniePod#597 trailing-time-word trim never reached this case because it runs on
the already-split location, after the city was gone.
|
Thanks for the review, @matedev01 — no argument that this is the same area as #597/#615. One thing I wanted to flag in case it changes the call: On current #597 trims trailing time words from the location, but it runs after This PR strips the |
Summary
The deterministic quick-router extracts a weather location with
rsplit_once(" in ")— the last" in "in the utterance. A natural querythat ends with an "in the " phrase therefore loses the city:
"what's the weather in Denver in the morning?"routed toget_weather{location: "morning"}and geocoded the wrong place, instead oflocation: "denver". It is a wrong tool-call argument — exactly what the BFCLtool-call scoring measures — across a whole class of everyday phrasings.
The existing trailing-time-word trim (#597) never fixes this, because the city
is already discarded by the marker split before that per-location trim runs.
Changes
extract_location_after_marker(crates/genie-core/src/tools/quick.rs):strip a trailing
" in the morning/afternoon/evening/night"phrase beforethe
rsplit_once(marker)split, so the city survives. Forecast detection readsthe whole utterance, so it is unaffected.
weather_location_drops_trailing_time_qualifierwith the threepreviously-broken phrasings (Denver/Austin/Tokyo "in the morning/evening/afternoon").
Real Behavior Proof
Tested profile / hardware (check all that apply):
jetsonraspberry_piportable_sbclaptopmacWhat I ran
x86_64 Linux laptop, stable Rust (
cargo 1.96.1). The changed code isplatform-agnostic string routing (
str::rsplit_once/str::trim_end_matches),so an x86_64 build exercises the exact logic that runs on Jetson. I wrote the
regression cases first and ran them against unmodified
mainto confirm thebug, then applied the fix:
What I observed
weather_location_drops_trailing_time_qualifierfailed —left: "morning", right: "denver"for"what's the weather in Denver in the morning?".tools::quick52 passed / 0 failed;genie-core --lib822 passed / 0 failed / 4 ignored.--no-default-features): 0 warnings.