Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/src/main/java/com/google/adk/flows/llmflows/Contents.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,17 @@ private static List<Event> rearrangeEventsForAsyncFunctionResponsesInHistory(Lis
}
}
} else {
// Exclude events that contain function response parts;
// Each valid function response event will be added within the function call handling logic.
// Bad case: FC1,FR1,FR2,FC2 -> FC1,FR1,FR2,FC2,FR2; FR2 is added duplicate
boolean hasFunctionResponse =
partsOptional
.map(parts -> parts.stream().anyMatch(p -> p.functionResponse().isPresent()))
.orElse(false);

if (hasFunctionResponse) {
continue;
}
resultEvents.add(event);
}
}
Expand Down