[Router] use call_id instead of id for matching function calls in Responses API for Harmony (#13056)

This commit is contained in:
Ziwen Zhao
2025-11-11 17:16:47 -08:00
committed by GitHub
parent 0d4a418424
commit 7b877ab83d
2 changed files with 6 additions and 6 deletions
@@ -603,11 +603,11 @@ impl HarmonyBuilder {
.iter() .iter()
.rev() .rev()
.find_map(|item| match item { .find_map(|item| match item {
ResponseInputOutputItem::FunctionToolCall { id, name, .. } ResponseInputOutputItem::FunctionToolCall {
if id == call_id => call_id: item_call_id,
{ name,
Some(name.clone()) ..
} } if item_call_id == call_id => Some(name.clone()),
_ => None, _ => None,
}) })
.ok_or_else(|| format!("No function call found for call_id: {}", call_id))?; .ok_or_else(|| format!("No function call found for call_id: {}", call_id))?;
@@ -1353,7 +1353,7 @@ fn build_next_request_with_tools(
.. ..
}) = items }) = items
.iter_mut() .iter_mut()
.find(|item| matches!(item, ResponseInputOutputItem::FunctionToolCall { id, .. } if id == &tool_result.call_id)) .find(|item| matches!(item, ResponseInputOutputItem::FunctionToolCall { call_id, .. } if call_id == &tool_result.call_id))
{ {
*output = Some(output_str); *output = Some(output_str);
*status = if tool_result.is_error { *status = if tool_result.is_error {