AutoGen — python v0.5.1
AutoGen releases Python v0.5.1 with a breaking type-hint change in AgentChat, replacing `ChatMessage` and `AgentEvent` union types with `BaseChatMessage` and `BaseAgentEvent` base classes to support custom message types.
What's New AgentChat Message Types (Type Hint Changes) [!IMPORTANT] TL;DR: If you are not using custom agents or custom termination conditions, you don't need to change anything. Otherwise, update `AgentEvent` to `BaseAgentEvent` and `ChatMessage` to `BaseChatMessage` in your type hints. This is a breaking change on type hinting only, not on usage. We updated the message types in AgentChat in this new release. The purpose of this change is to support custom message types defined by applications. Previously, message types are fixed and we use the union types `ChatMessage` and `AgentEvent` to refer to all the concrete built-in message types.
Now, in the main branch, the message types are organized into hierarchy: existing built-in concrete message types are subclassing either `BaseChatMessage` and `BaseAgentEvent`, depending it was part of the `ChatMessage` or `AgentEvent` union. We refactored all message handlers `on_messages`, `on_messages_stream`, `run`, `run_stream` and `TerminationCondition` to use the base classes in their type hints. If you are subclassing `BaseChatAgent` to create your custom agents, or subclassing `TerminationCondition` to create your custom termination…
- github.comautogen python-v0.5.1primary