Fix: Expand broken tool call repair patterns
Added 3 new repair patterns to handle additional hallucinated formats:
1. Pattern -1: Fix <tool_call> wrapper format
- Converts <tool_call><list_files></list_files> to proper <tool> wrapper
- Handles nested <tool_call><tool>...</tool></tool_call> format
2. Pattern -2: Handle wrong wrapper tags
- Fixes when model uses tool name as wrapper: <fetch_instructions>...</fetch_instructions>
- Converts to proper JSON format: {"name": "tool_name", "arguments": {...}}
- Supports all known tools (read_file, list_files, etc.)
3. Pattern -3: Handle incomplete tool calls with missing parameters
- Detects <tool><list_files></list_files> (no parameters)
- Provides sensible defaults: list_files gets path='.' and recursive=False
- Prevents extraction failures due to missing required parameters
These patterns fix the hallucination issues observed in debug.log where the model
produces broken XML formats despite --ggg (grammar-guided generation) being enabled.
Showing
Please
register
or
sign in
to comment