removed some extra logging

This commit is contained in:
Dhanji Prasanna
2025-09-15 09:22:21 +10:00
parent 2e829e23c3
commit 9b6851c4f5

View File

@@ -54,18 +54,16 @@ impl StreamingToolParser {
// Look for JSON tool call pattern - check both raw JSON and inside code blocks // Look for JSON tool call pattern - check both raw JSON and inside code blocks
// Also handle malformed patterns and whitespace variations // Also handle malformed patterns and whitespace variations
let patterns = [ let patterns = [
r#"{"tool":"#, // Normal pattern r#"{"tool":"#, // Normal pattern
r#"{ "tool":"#, // Pattern with space after opening brace r#"{ "tool":"#, // Pattern with space after opening brace
r#"{"tool" :"#, // Pattern with space before colon r#"{"tool" :"#, // Pattern with space before colon
r#"{ "tool" :"#, // Pattern with spaces around tool r#"{ "tool" :"#, // Pattern with spaces around tool
r#"{"{""tool"":"#, // Malformed pattern with extra brace and doubled quotes r#"{"{""tool"":"#, // Malformed pattern with extra brace and doubled quotes
r#"{{""tool"":"#, // Alternative malformed pattern r#"{{""tool"":"#, // Alternative malformed pattern
]; ];
for pattern in &patterns { for pattern in &patterns {
if let Some(pos) = self.buffer.rfind(pattern) { if let Some(pos) = self.buffer.rfind(pattern) {
info!("Found tool call pattern '{}' at position: {}", pattern, pos);
// Check if this is inside a code block // Check if this is inside a code block
let before_pos = &self.buffer[..pos]; let before_pos = &self.buffer[..pos];
let _code_block_count = before_pos.matches("```").count(); let _code_block_count = before_pos.matches("```").count();
@@ -135,7 +133,6 @@ impl StreamingToolParser {
if json_str.contains(r#""tool": "shell""#) { if json_str.contains(r#""tool": "shell""#) {
let fixed_json = fix_nested_quotes_in_shell_command(&json_str); let fixed_json = fix_nested_quotes_in_shell_command(&json_str);
if let Ok(tool_call) = serde_json::from_str::<ToolCall>(&fixed_json) { if let Ok(tool_call) = serde_json::from_str::<ToolCall>(&fixed_json) {
info!("Successfully parsed tool call after fixing nested quotes: {:?}", tool_call);
// Reset parser state // Reset parser state
self.in_tool_call = false; self.in_tool_call = false;
self.tool_start_pos = None; self.tool_start_pos = None;
@@ -699,8 +696,6 @@ The tool will execute immediately and you'll receive the result (success or erro
Ok(json_content) => { Ok(json_content) => {
if let Err(e) = fs::write(&filename, json_content) { if let Err(e) = fs::write(&filename, json_content) {
error!("Failed to save context window to {}: {}", filename, e); error!("Failed to save context window to {}: {}", filename, e);
} else {
info!("Context window saved to {}", filename);
} }
} }
Err(e) => { Err(e) => {
@@ -997,11 +992,6 @@ The tool will execute immediately and you'll receive the result (success or erro
} }
// Continue the loop to start a new stream with updated context // Continue the loop to start a new stream with updated context
info!(
"Starting new stream iteration {} with {} messages",
iteration_count,
request.messages.len()
);
} }
// If we exit the loop due to max iterations // If we exit the loop due to max iterations