-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Use class hierarchy to organize AgentChat message types and introduce StructuredMessage type #5998
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5998 +/- ##
==========================================
+ Coverage 76.78% 76.89% +0.11%
==========================================
Files 191 191
Lines 13252 13358 +106
==========================================
+ Hits 10175 10272 +97
- Misses 3077 3086 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
python/packages/autogen-agentchat/src/autogen_agentchat/messages.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-agentchat/src/autogen_agentchat/messages.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-agentchat/src/autogen_agentchat/messages.py
Outdated
Show resolved
Hide resolved
In generally I like this PR. I worry a little about the really long method names like I'm also not sure about |
I changed it to |
@jackgerrits @victordibia @afourney I made the change we have discussed so the type hints won't change, just replaced union with base class. |
This PR refactored
AgentEvent
andChatMessage
union types to abstract base classes. This allows for user-defined message types that subclass one of the base classes to be used in AgentChat.To support a unified interface for working with the messages, the base classes added abstract methods for:
UserMessage
for model clientThis way, all agents such as
AssistantAgent
andSocietyOfMindAgent
can utilize the unified interface to work with any built-in and user-defined message type.This PR also introduces a new message type,
StructuredMessage
for AgentChat (Resolves #5131), which is a generic type that requires a user-specified content type.You can create a
StructuredMessage
as follow:This PR addresses the receving side of this message type. To produce this message type from
AssistantAgent
, the work continue in #5934.Added unit tests to verify this message type works with agents and teams.