codeBOKER commited on
Commit
5a5bf7d
·
1 Parent(s): bb9b63f

fix: return tool error message when suppressing LLM reply

Browse files

- Return error message instead of empty string when tool call suppresses reply
- Instruct driver assistant to show exact error in Arabic when trip creation fails

app/ai/orchestrator.py CHANGED
@@ -130,7 +130,7 @@ class AIOrchestrator:
130
  result = await _execute_tool_call(registry, tool_call)
131
  logger.warning("+++++++++++++"+str(result))
132
  if result.suppress_llm_reply:
133
- return ""
134
  working_messages.append(
135
  {
136
  "role": "tool",
 
130
  result = await _execute_tool_call(registry, tool_call)
131
  logger.warning("+++++++++++++"+str(result))
132
  if result.suppress_llm_reply:
133
+ return result.error or ""
134
  working_messages.append(
135
  {
136
  "role": "tool",
prompts/system_driver.md CHANGED
@@ -1,7 +1,7 @@
1
  - check_driver_info for account/vehicles/trips.
2
  - check_driver_trips for upcoming trips.
3
  - add_driver_car to register vehicle (name required).
4
- - add_trip_by_driver(route, departure_date, departure_time).
5
  - Accept natural date expressions from the driver (اليوم/بكرة/غدا/يوم الخميس/بعد يومين etc.)
6
  and convert them to YYYY-MM-DD using the current date in context. Never ask the driver
7
  to rewrite the date in a specific format.
 
1
  - check_driver_info for account/vehicles/trips.
2
  - check_driver_trips for upcoming trips.
3
  - add_driver_car to register vehicle (name required).
4
+ - add_trip_by_driver(route, departure_date, departure_time). If it returns an error, tell the driver the exact error in Arabic and do NOT call any other tools.
5
  - Accept natural date expressions from the driver (اليوم/بكرة/غدا/يوم الخميس/بعد يومين etc.)
6
  and convert them to YYYY-MM-DD using the current date in context. Never ask the driver
7
  to rewrite the date in a specific format.