You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Check if this is the last turn (no following turn for responses)
451
+
ifi==len(contents)-1 {
452
+
returnfmt.Errorf(
453
+
"Function call/response parity violation: model turn at index %d (last turn) has %d function calls but no following user turn with responses. Function calls must be followed by a user turn with matching function responses.",
"Function call/response parity violation: model turn at index %d has %d function calls but the following turn at index %d is invalid.",
463
+
i, functionCallCount, i+1,
464
+
)
465
+
}
466
+
467
+
// The next turn MUST be a user turn with function responses
468
+
nextRole, hasNextRole:=nextTurn["role"].(string)
469
+
if!hasNextRole||nextRole!="user" {
470
+
// This is an error - function calls must be immediately followed by user responses
471
+
returnfmt.Errorf(
472
+
"Function call/response parity violation: model turn at index %d has %d function calls but is followed by a %s turn instead of a user turn with function responses.",
"Function call/response parity violation: model turn at index %d has %d function calls, but following user turn has %d function responses. Every function call must have exactly one corresponding response.",
0 commit comments