Note:invoke now returns an AIMessage when a tool call is returned and a ChatMessage otherwise. The old behavior was to always return a ChatMessage. This new behavior is not technically API breaking because invoke declares it returns a BaseMessage and both AIMessage & ChatMessage are children of BaseMessage. However, AIMessage and ChatMessage are siblings and not compatible. ChatMessage has a role property that is not present on either BaseMessage or AIMessage. A user who expected role in the response will be broken by this change.
Note:
invoke
now returns anAIMessage
when a tool call is returned and aChatMessage
otherwise. The old behavior was to always return aChatMessage
. This new behavior is not technically API breaking becauseinvoke
declares it returns aBaseMessage
and bothAIMessage
&ChatMessage
are children ofBaseMessage
. However,AIMessage
andChatMessage
are siblings and not compatible.ChatMessage
has arole
property that is not present on eitherBaseMessage
orAIMessage
. A user who expectedrole
in the response will be broken by this change.