prompt change

This commit is contained in:
Dhanji Prasanna
2025-10-11 15:07:47 +11:00
parent e89e1acf41
commit 658a335615

View File

@@ -176,16 +176,16 @@ impl StreamingToolParser {
// This would indicate a malformed tool call where the message // This would indicate a malformed tool call where the message
// got mixed into the args // got mixed into the args
let has_message_like_key = args_obj.keys().any(|key| { let has_message_like_key = args_obj.keys().any(|key| {
key.len() > 100 || key.len() > 100
key.contains('\n') || || key.contains('\n')
key.contains("I'll") || || key.contains("I'll")
key.contains("Let me") || || key.contains("Let me")
key.contains("Here's") || || key.contains("Here's")
key.contains("I can") || || key.contains("I can")
key.contains("I need") || || key.contains("I need")
key.contains("First") || || key.contains("First")
key.contains("Now") || || key.contains("Now")
key.contains("The ") || key.contains("The ")
}); });
if has_message_like_key { if has_message_like_key {
@@ -200,7 +200,10 @@ impl StreamingToolParser {
// Tool arguments should typically be file paths, commands, or content // Tool arguments should typically be file paths, commands, or content
// Not entire agent messages // Not entire agent messages
debug!("Successfully parsed valid JSON tool call: {:?}", tool_call); debug!(
"Successfully parsed valid JSON tool call: {:?}",
tool_call
);
// Reset JSON parsing state // Reset JSON parsing state
self.in_json_tool_call = false; self.in_json_tool_call = false;
self.json_tool_start = None; self.json_tool_start = None;
@@ -708,10 +711,9 @@ You have access to tools. When you need to accomplish a task, you MUST use the a
IMPORTANT: You must call tools to achieve goals. When you receive a request: IMPORTANT: You must call tools to achieve goals. When you receive a request:
1. Analyze and identify what needs to be done 1. Analyze and identify what needs to be done
2. Call the appropriate tool with the required parameters 2. Call the appropriate tool with the required parameters
3. Wait for the tool result 3. Continue or complete the task based on the result
4. Continue or complete the task based on the result 4. If you repeatedly try something and it fails, try a different approach
5. If you repeatedly try something and it fails, try a different approach 5. Call the final_output tool with a detailed summary when done.
6. Call the final_output task with a detailed summary when done with all tasks.
For shell commands: Use the shell tool with the exact command needed. Avoid commands that produce a large amount of output, and consider piping those outputs to files. Example: If asked to list files, immediately call the shell tool with command parameter \"ls\". For shell commands: Use the shell tool with the exact command needed. Avoid commands that produce a large amount of output, and consider piping those outputs to files. Example: If asked to list files, immediately call the shell tool with command parameter \"ls\".
If you create temporary files or data for testing, place these in a subdir named 'tmp'. Do NOT pollute the current dir. If you create temporary files or data for testing, place these in a subdir named 'tmp'. Do NOT pollute the current dir.
@@ -1991,12 +1993,14 @@ The tool will execute immediately and you'll receive the result (success or erro
let start_boundary = if start == 0 { let start_boundary = if start == 0 {
0 0
} else { } else {
content.char_indices() content
.char_indices()
.find(|(i, _)| *i >= start) .find(|(i, _)| *i >= start)
.map(|(i, _)| i) .map(|(i, _)| i)
.unwrap_or(start) .unwrap_or(start)
}; };
let end_boundary = content.char_indices() let end_boundary = content
.char_indices()
.find(|(i, _)| *i >= end) .find(|(i, _)| *i >= end)
.map(|(i, _)| i) .map(|(i, _)| i)
.unwrap_or(content.len()); .unwrap_or(content.len());
@@ -2009,7 +2013,11 @@ The tool will execute immediately and you'll receive the result (success or erro
if start_char.is_some() || end_char.is_some() { if start_char.is_some() || end_char.is_some() {
Ok(format!( Ok(format!(
"📄 File content (chars {}-{}, {} lines of {} total):\n{}", "📄 File content (chars {}-{}, {} lines of {} total):\n{}",
start_boundary, end_boundary, line_count, total_lines, partial_content start_boundary,
end_boundary,
line_count,
total_lines,
partial_content
)) ))
} else { } else {
Ok(format!( Ok(format!(
@@ -2621,12 +2629,14 @@ pub fn apply_unified_diff_to_string(
let start_boundary = if search_start == 0 { let start_boundary = if search_start == 0 {
0 0
} else { } else {
content_norm.char_indices() content_norm
.char_indices()
.find(|(i, _)| *i >= search_start) .find(|(i, _)| *i >= search_start)
.map(|(i, _)| i) .map(|(i, _)| i)
.unwrap_or(search_start) .unwrap_or(search_start)
}; };
let end_boundary = content_norm.char_indices() let end_boundary = content_norm
.char_indices()
.find(|(i, _)| *i >= search_end) .find(|(i, _)| *i >= search_end)
.map(|(i, _)| i) .map(|(i, _)| i)
.unwrap_or(content_norm.len()); .unwrap_or(content_norm.len());
@@ -2654,7 +2664,10 @@ pub fn apply_unified_diff_to_string(
} }
let range_note = if start_char.is_some() || end_char.is_some() { let range_note = if start_char.is_some() || end_char.is_some() {
format!(" (within character range {}:{})", start_boundary, end_boundary) format!(
" (within character range {}:{})",
start_boundary, end_boundary
)
} else { } else {
String::new() String::new()
}; };