Skip to content

adk-java: Contents.rearrangeEventsForAsyncFunctionResponsesInHistory method could generate duplicate function Response type event casusing message disorder, leading to model invocation failure. #632

@yuhao101

Description

@yuhao101

** Please make sure you read the contribution guide and file the issues in the rigth place. **
Contribution guide.

Describe the bug
Contents.rearrangeEventsForAsyncFunctionResponsesInHistory method could generate duplicate function Response type event, casusing message disorder, leading to model invocation failure.

To Reproduce
Steps to reproduce the behavior:
Bad case:
If filtered events order are FC1,FR1,FR2,FC2, after execute rearrangeEventsForAsyncFunctionResponsesInHistory we will get a new events list like: FC1,FR1,FR2,FC2,FR2; In this case, FR2 is added duplicate

Expected behavior
Add the following check code to avoid dupplicate adding.

Image

Desktop (please complete the following information):

  • OS: [e.g. iOS] macos
  • Java version: 17
  • ADK version(see maven dependency): 0.4.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions