Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/drive-thru/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ async def order_combo_meal(
Regular items like a single cheeseburger cannot be made into a meal unless such a combo explicitly exists.

Only call this function once the user has clearly specified both a drink and a sauce — always ask for them if they're missing.
Never infer or assume the drink — if the user has not explicitly named a drink, ask for it before calling this tool.

A meal can only be Medium or Large; Small is not an available option.
Drink and fries sizes can differ (e.g., “large fries but a medium Coke”).
Expand Down Expand Up @@ -293,6 +294,7 @@ async def order_regular_item(
Call this when the user orders **a single item on its own**, not as part of a Combo Meal or Happy Meal.

The customer must provide clear and specific input. For example, item variants such as flavor must **always** be explicitly stated.
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.

The user might say—for example:
- “Just the cheeseburger, no meal”
Expand Down
3 changes: 3 additions & 0 deletions examples/drive-thru/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"Do not ask again to confirm the size of the drink or fries. This inference is meant to streamline the interaction. \n"
"If the customer clearly indicates a different size for the fries or drink, respect their preference. \n"
"\n\n"
"Never infer or assume any detail the customer has not explicitly stated — especially the drink for a combo meal. \n"
"If a required detail is missing, always ask the customer before calling any tool. \n"
"\n\n"
"Be fast-keep responses short and snappy. \n"
"Sound human-sprinkle in light vocal pauses like 'Mmh…', 'Let me see…', or 'Alright…' at natural moments-but not too often. \n"
"Keep everything upbeat and easy to follow. Never overwhelm the customer, don't ask multiple questions at the same time. \n"
Expand Down
22 changes: 14 additions & 8 deletions examples/frontdesk/frontdesk_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,26 @@ async def schedule_appointment(
)
except SlotUnavailableError:
ctx.userdata.slot_unavailable_count += 1
get_job_context().tagger.add(
"slot:unavailable",
metadata={"count": ctx.userdata.slot_unavailable_count},
)
try:
get_job_context().tagger.add(
"slot:unavailable",
metadata={"count": ctx.userdata.slot_unavailable_count},
)
except RuntimeError:
pass
# exceptions other than ToolError are treated as "An internal error occurred" for the LLM.
# Tell the LLM this slot isn't available anymore
raise ToolError("This slot isn't available anymore") from None

local = slot.start_time.astimezone(self.tz)
ctx.userdata.booked_times.append(local.isoformat())
get_job_context().tagger.add(
"appointment:booked",
metadata={"time": ctx.userdata.booked_times},
)
try:
get_job_context().tagger.add(
"appointment:booked",
metadata={"time": ctx.userdata.booked_times},
)
except RuntimeError:
pass
return f"The appointment was successfully scheduled for {local.strftime('%A, %B %d, %Y at %H:%M %Z')}."

@function_tool
Expand Down
Loading