GameTheory Claude Sonnet 4.6 commited on
Commit
4cff0da
·
1 Parent(s): 6901b75

fix: return short prompt when 'my village' named but no village specified

Browse files

Prevents the full route calendar dump when user clicks 'Find my village's
schedule' without yet naming a village — LLM was listing all 27 routes as
'examples'. Now returns a one-line prompt asking for the village name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. query_tool.py +11 -0
query_tool.py CHANGED
@@ -430,6 +430,17 @@ class LibraryQueryTool:
430
  if not has_trigger and not (month_in_q is not None and has_mobile_ctx) and not (has_relative_day and has_mobile_ctx):
431
  return None
432
 
 
 
 
 
 
 
 
 
 
 
 
433
  today = datetime.date.today()
434
 
435
  # Handle "today" / "tomorrow" — return routes running on that specific date
 
430
  if not has_trigger and not (month_in_q is not None and has_mobile_ctx) and not (has_relative_day and has_mobile_ctx):
431
  return None
432
 
433
+ # If the user said "my village" / "my town" / "my area" without naming one,
434
+ # return a short prompt rather than flooding them with every route's schedule.
435
+ _PLACEHOLDER_VILLAGE = {"my village", "my town", "my area", "my location", "my place"}
436
+ if any(ph in q for ph in _PLACEHOLDER_VILLAGE) and not has_relative_day and not month_in_q:
437
+ return (
438
+ "**Mobile Library — find your village's schedule**\n\n"
439
+ "Just tell me the name of your village or town and I'll look up "
440
+ "when the mobile library visits.\n\n"
441
+ "*Example: \"When does the mobile library visit Kempsey?\"*"
442
+ )
443
+
444
  today = datetime.date.today()
445
 
446
  # Handle "today" / "tomorrow" — return routes running on that specific date