From a310df3df316ba827c84f8ef1c98e607a0a69a61 Mon Sep 17 00:00:00 2001 From: "Amar Sood (tekacs)" Date: Fri, 11 Apr 2025 14:16:44 -0400 Subject: [PATCH] Allow escaping of tool calls by the model --- aider/coders/navigator_coder.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aider/coders/navigator_coder.py b/aider/coders/navigator_coder.py index d3f2fb994..042622865 100644 --- a/aider/coders/navigator_coder.py +++ b/aider/coders/navigator_coder.py @@ -363,7 +363,16 @@ class NavigatorCoder(Coder): processed_content += content[last_index:] break - # Append content before the tool call + # Check for escaped tool call: \[tool_call( + if start_pos > 0 and content[start_pos - 1] == '\\': + # Append the content including the escaped marker + # We append up to start_pos + len(start_marker) to include the marker itself. + processed_content += content[last_index : start_pos + len(start_marker)] + # Update last_index to search after this escaped marker + last_index = start_pos + len(start_marker) + continue # Continue searching for the next potential marker + + # Append content before the (non-escaped) tool call processed_content += content[last_index:start_pos] scan_start_pos = start_pos + len(start_marker)