* Replace the tool_use output format instruction with XML format. * Finds the last line of the prompt ("Use the classify_result tool...") * and replaces it with XML output instructions.
(systemPrompt: string)
| 646 | * and replaces it with XML output instructions. |
| 647 | */ |
| 648 | function replaceOutputFormatWithXml(systemPrompt: string): string { |
| 649 | const toolUseLine = |
| 650 | 'Use the classify_result tool to report your classification.' |
| 651 | const xmlFormat = [ |
| 652 | '## Output Format', |
| 653 | '', |
| 654 | 'If the action should be blocked:', |
| 655 | '<block>yes</block><reason>one short sentence</reason>', |
| 656 | '', |
| 657 | 'If the action should be allowed:', |
| 658 | '<block>no</block>', |
| 659 | '', |
| 660 | 'Do NOT include a <reason> tag when the action is allowed.', |
| 661 | 'Your ENTIRE response MUST begin with <block>. Do NOT output any analysis, reasoning, or commentary before <block>. No "Looking at..." or similar preamble.', |
| 662 | ].join('\n') |
| 663 | return systemPrompt.replace(toolUseLine, xmlFormat) |
| 664 | } |
| 665 | |
| 666 | /** |
| 667 | * Thinking config for classifier calls. The classifier wants short text-only |
no outgoing calls
no test coverage detected