Skip to content

Fix append last message in a_run_chat before termination check (#3561)#7489

Open
wrenevens wants to merge 2 commits intomicrosoft:0.2from
wrenevens:fix/a_initiate_chat-missing-last-message
Open

Fix append last message in a_run_chat before termination check (#3561)#7489
wrenevens wants to merge 2 commits intomicrosoft:0.2from
wrenevens:fix/a_initiate_chat-missing-last-message

Conversation

@wrenevens
Copy link
Copy Markdown

Why are these changes needed?

When using a_initiate_chat with a GroupChat of multiple agents,
the last agent's message was missing from the response history.

Root cause: in a_run_chat, the termination check happened BEFORE
broadcasting the message to all agents, causing the loop to exit
before the last message was appended to chat history.
The sync run_chat does not have this issue.

Changes made to bring a_run_chat in line with sync run_chat:

  • Moved termination check to AFTER the broadcast
  • Combined the two separate break conditions into one
  • Added self._last_speaker = speaker which was missing in async
  • Added NoEligibleSpeaker exception handling missing in async

Related issue number

Closes #3561

Checks

@wrenevens
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant