From f69aeb6311dde3c0b8979c293d019d66498d54f2 Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Wed, 23 Apr 2025 16:19:01 +0300 Subject: [PATCH] Do not log unfinished tools use that are in the middle of streaming (#29275) Release Notes: - N/A --- crates/eval/src/instance.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/eval/src/instance.rs b/crates/eval/src/instance.rs index 641a19a5bbbfc49029fc6688a080aff0e362295f..9210d0b8186f8f249d1dc433345846c25a85ac88 100644 --- a/crates/eval/src/instance.rs +++ b/crates/eval/src/instance.rs @@ -1030,14 +1030,11 @@ impl ThreadDialog { current_text.push_str(text); } - // TODO: Tool use is currently broken, both here and in Markdown output. - // Specifically, we get a stream of partial `tool_use` messages, - // each of which gets logged individually. A simple fix is to log - // just the final message, but we also need to make sure that - // this behavior doesn't happen in the actual assistant thread. Ok(LanguageModelCompletionEvent::ToolUse(tool_use)) => { flush_text(&mut current_text, &mut content); - content.push(MessageContent::ToolUse(tool_use.clone())); + if tool_use.is_input_complete { + content.push(MessageContent::ToolUse(tool_use.clone())); + } } Ok(LanguageModelCompletionEvent::Thinking { text, signature }) => { flush_text(&mut current_text, &mut content);