Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for list of messages as team task input #4500

Merged
merged 30 commits into from
Dec 15, 2024

Conversation

iamarunbrahma
Copy link
Contributor

@iamarunbrahma iamarunbrahma commented Dec 3, 2024

Why are these changes needed?

Currently, a team only supports a single message as input for a task. This limits the ability to prepopulate context for agents, especially when working with previous conversation histories or nested chats. This PR adds support for passing a list of messages as task input, enabling better integration with applications where users might type multiple messages before triggering the team run.

Key changes:

  • Added support for List[ChatMessage] as valid task input
  • Messages are processed sequentially, maintaining conversation flow
  • Added validation for message lists (empty lists, invalid message types)
  • Maintained backward compatibility with existing string and single message inputs
  • Added comprehensive test coverage for the new functionality

Related issue number

Resolves #4472

Checks

@iamarunbrahma
Copy link
Contributor Author

@microsoft-github-policy-service agree

@gagb gagb added the group chat/teams group-chat-related issues label Dec 4, 2024
@ekzhu
Copy link
Collaborator

ekzhu commented Dec 4, 2024

Thanks @iamarunbrahma for the PR. It's a good start, but to finish it is going to be some more work. Please let us know ASAP when you are blocked.

please also review the Python development guide under python directory.

@iamarunbrahma
Copy link
Contributor Author

Thanks @iamarunbrahma for the PR. It's a good start, but to finish it is going to be some more work. Please let us know ASAP when you are blocked.

please also review the Python development guide under python directory.

Thanks @ekzhu , yes I have reviewed the python development guide. Kindly, review the updated PR and let me know if you have any more suggesstions

@gagb gagb requested a review from Copilot December 4, 2024 22:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 suggestion.

Comments skipped due to low confidence (2)

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py:367

  • Use parentheses for the union of types in the isinstance check: isinstance(task, (TextMessage, MultiModalMessage, StopMessage, HandoffMessage)).
elif isinstance(task, TextMessage | MultiModalMessage | StopMessage | HandoffMessage):

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py:371

  • [nitpick] The error message 'Task list cannot be empty' could be more descriptive, e.g., 'The task list provided is empty. Please provide at least one valid ChatMessage.'
raise ValueError("Task list cannot be empty")

@iamarunbrahma iamarunbrahma requested a review from ekzhu December 12, 2024 04:53
@ekzhu ekzhu merged commit 7c0bbf6 into microsoft:main Dec 15, 2024
47 checks passed
@ekzhu ekzhu mentioned this pull request Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group chat/teams group-chat-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Team to support a list of messages as input to a task
4 participants