Skip to content

Commit af0235e

Browse files
committed
uses tn map keys as list of tools for dummy substitute
1 parent e05fe3e commit af0235e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

crates/chat-cli/src/cli/chat/conversation_state.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,11 @@ impl ConversationState {
306306
// do this if the last message is a tool call that has failed.
307307
let tool_use_results = user_msg.tool_use_results();
308308
if let Some(tool_use_results) = tool_use_results {
309-
let tool_name_list = self
310-
.tools
311-
.values()
312-
.flatten()
313-
.map(|Tool::ToolSpecification(spec)| spec.name.as_str())
314-
.collect::<Vec<_>>();
309+
// Note that we need to use the keys in tool manager's tn_map as the keys are the
310+
// actual tool names as exposed to the model and the backend. If we use the actual
311+
// names as they are recognized by their respective servers, we risk concluding
312+
// with false positives.
313+
let tool_name_list = self.tool_manager.tn_map.keys().map(String::as_str).collect::<Vec<_>>();
315314
for result in tool_use_results {
316315
if let ToolResultStatus::Error = result.status {
317316
let tool_use_id = result.tool_use_id.as_str();

0 commit comments

Comments
 (0)