ensure seen call ids only after valid function_call is emitted

This commit is contained in:
DBT
2026-02-24 10:08:22 +00:00
parent 77cf21ce01
commit 8988002c5a

View File

@@ -233,9 +233,6 @@ func toResponsesInputItemsWithState(msg Message, seenCalls map[string]struct{})
if callID == "" { if callID == "" {
continue continue
} }
if seenCalls != nil {
seenCalls[callID] = struct{}{}
}
name := strings.TrimSpace(tc.Name) name := strings.TrimSpace(tc.Name)
argsRaw := "" argsRaw := ""
if tc.Function != nil { if tc.Function != nil {
@@ -255,6 +252,9 @@ func toResponsesInputItemsWithState(msg Message, seenCalls map[string]struct{})
argsRaw = string(argsJSON) argsRaw = string(argsJSON)
} }
} }
if seenCalls != nil {
seenCalls[callID] = struct{}{}
}
items = append(items, map[string]interface{}{ items = append(items, map[string]interface{}{
"type": "function_call", "type": "function_call",
"call_id": callID, "call_id": callID,