fix(hotel_receptionist): stop a restaurant modification silently resizing the party - #6806
Open
u9g wants to merge 3 commits into
Open
fix(hotel_receptionist): stop a restaurant modification silently resizing the party#6806u9g wants to merge 3 commits into
u9g wants to merge 3 commits into
Conversation
…eep it the same" change A caller who says "same party size, just move it to Friday" leaves the current values only in the reservation record. Point lookup_restaurant_reservation at that case so the model reads them before modifying.
… a party size "omit to keep the current party size" reads as a default, so the model fills the parameter anyway - with the size it guesses rather than one the caller stated, silently resizing the reservation. Make omission the instruction for that case.
…ification The stored party size is what the modification actually wrote; confirming only date and time leaves a wrong count unspoken and so uncorrectable.
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.
Summary
The
examples/hotel_receptionist/tools_restaurant.pychanges from #6567, brought in as independent semantic commits so each one stands or falls on its own. Wording is verbatim from #6567. Oldest first:lookup_restaurant_reservationnow names that case, so the current values are in context before the modification.modify_restaurant_reservationinventing a party size — "omit to keep the current party size" reads as a description of a default rather than an instruction, so the model fills the parameter anyway, with a number it guessed rather than one the caller stated, and silently resizes the reservation. Omission is now stated as the instruction for that case.2 and 3 are separate on purpose: 2 keeps a wrong count from being written, 3 catches one that got written anyway, whatever wrote it.
Not included. #6567 also wraps
start_restaurant_bookingin atry/except RestaurantReservationNotCreatedError. #6801 already covers that case, landing the same behavior differently:BookRestaurantTaskcompletes with a plainToolError, which propagates out of theawait, so the tool needs no catch and noToolErrorsubclass. One nuance of #6567's wording has no home in either PR — it also tells the agent not to offer to connect or transfer the caller to the restaurant when they ask to hold the table without a phone number. That belongs on #6801's instruction text if it's wanted.One thing worth a second opinion, inherited from #6567's wording rather than introduced here: under a strict tool schema
new_party_sizeisrequiredwith type["integer", "null"], so the model cannot literally omit it and must passnullinstead. Both land asNoneand both leave the party size untouched (verified below), so the behavior is right in both modes, but "OMIT this parameter" is what a strict-mode model reads.Testing
ruff checkandruff format --checkclean on each of the three commits individuallybuild_legacy_openai_schemaandbuild_strict_openai_schema) carry the new description and parameter text forlookup_restaurant_reservationandmodify_restaurant_reservationparty_size == 4both withnew_party_sizeomitted and with it explicitlynull, and the tool return reads back4 guestsfollowed by the new confirm directiveExercising the tool path at all needs a workaround for a bug this PR does not touch:
book_restaurantstores the code lowercase whilefind_restaurant_reservationuppercases the code it searches for, so no by-code lookup can ever match. That is #6805's second commit. Onmaintoday,lookup_restaurant_reservation,cancel_restaurant_reservation, andmodify_restaurant_reservationall fail against any reservation booked in-session, independent of anything here.