Skip to content

Commit ad4f61c

Browse files
authored
fix(tests): update drive thru instructions (#5405)
1 parent caadae2 commit ad4f61c

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

examples/drive-thru/agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ async def order_combo_meal(
124124
Regular items like a single cheeseburger cannot be made into a meal unless such a combo explicitly exists.
125125
126126
Only call this function once the user has clearly specified both a drink and a sauce — always ask for them if they're missing.
127+
Never infer or assume the drink — if the user has not explicitly named a drink, ask for it before calling this tool.
127128
128129
A meal can only be Medium or Large; Small is not an available option.
129130
Drink and fries sizes can differ (e.g., “large fries but a medium Coke”).
@@ -293,6 +294,7 @@ async def order_regular_item(
293294
Call this when the user orders **a single item on its own**, not as part of a Combo Meal or Happy Meal.
294295
295296
The customer must provide clear and specific input. For example, item variants such as flavor must **always** be explicitly stated.
297+
Never call this tool when size information is still needed — if the item has multiple sizes and the user has not specified one, ask for the size before calling.
296298
297299
The user might say—for example:
298300
- “Just the cheeseburger, no meal”

examples/drive-thru/database.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"Do not ask again to confirm the size of the drink or fries. This inference is meant to streamline the interaction. \n"
1818
"If the customer clearly indicates a different size for the fries or drink, respect their preference. \n"
1919
"\n\n"
20+
"Never infer or assume any detail the customer has not explicitly stated — especially the drink for a combo meal. \n"
21+
"If a required detail is missing, always ask the customer before calling any tool. \n"
22+
"\n\n"
2023
"Be fast-keep responses short and snappy. \n"
2124
"Sound human-sprinkle in light vocal pauses like 'Mmh…', 'Let me see…', or 'Alright…' at natural moments-but not too often. \n"
2225
"Keep everything upbeat and easy to follow. Never overwhelm the customer, don't ask multiple questions at the same time. \n"

examples/frontdesk/frontdesk_agent.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,26 @@ async def schedule_appointment(
107107
)
108108
except SlotUnavailableError:
109109
ctx.userdata.slot_unavailable_count += 1
110-
get_job_context().tagger.add(
111-
"slot:unavailable",
112-
metadata={"count": ctx.userdata.slot_unavailable_count},
113-
)
110+
try:
111+
get_job_context().tagger.add(
112+
"slot:unavailable",
113+
metadata={"count": ctx.userdata.slot_unavailable_count},
114+
)
115+
except RuntimeError:
116+
pass
114117
# exceptions other than ToolError are treated as "An internal error occurred" for the LLM.
115118
# Tell the LLM this slot isn't available anymore
116119
raise ToolError("This slot isn't available anymore") from None
117120

118121
local = slot.start_time.astimezone(self.tz)
119122
ctx.userdata.booked_times.append(local.isoformat())
120-
get_job_context().tagger.add(
121-
"appointment:booked",
122-
metadata={"time": ctx.userdata.booked_times},
123-
)
123+
try:
124+
get_job_context().tagger.add(
125+
"appointment:booked",
126+
metadata={"time": ctx.userdata.booked_times},
127+
)
128+
except RuntimeError:
129+
pass
124130
return f"The appointment was successfully scheduled for {local.strftime('%A, %B %d, %Y at %H:%M %Z')}."
125131

126132
@function_tool

0 commit comments

Comments
 (0)