buildVerifyPrompt function
Builds the audit prompt for the opt-in second pass.
The one failure mode the first pass really has is a dropped condition: a request packing about six of them loses one, and the result still validates against the schema, so no amount of checking finds it. Re-reading the original request is the only thing that does.
Implementation
String buildVerifyPrompt(
List<FunctionTool> functions,
String request,
List<ToolCall> calls,
) =>
'You are a completeness auditor for an extracted function call.\n\n'
'ORIGINAL REQUEST:\n$request\n\n'
'EXTRACTED CALL:\n'
'${jsonEncode([
for (final c in calls) {'name': c.name, 'arguments': c.arguments}
])}\n\n'
'FUNCTION SCHEMAS:\n'
'${jsonEncode([for (final f in functions) f.toJson()])}\n\n'
'Find every condition stated in the ORIGINAL REQUEST that is NOT '
'represented in the\n'
'EXTRACTED CALL, then output the corrected call. If nothing is missing, '
'output the\n'
'extracted call unchanged.\n'
'Output ONLY:\n'
'$kToolCallMarker{"calls":[{"name":"...","arguments":{...}}]}';