#40788·长链

message_to_events 在重放过程中丢弃了 AIMessage.additional_kwargs

作者: aloktripathi1创建于 2026年9月23日更新于 2026年9月28日
标签bugcoreexternal

`message_to_events()` does not preserve `AIMessage.additional_kwargs` when converting a finalized `AIMessage` into the v3 protocol event stream. I am converting a finalized `AIMessage` with `message_to_events()` and expect the resulting `message-finish` event to retain the message's `additional_kwargs`. Instead, the `message-finish` event does not contain `additional_kwargs`, causing the data to be lost during replay. The behavior is inconsistent with the live streaming path, where `additional_kwargs` is preserved.

内容来源: langchain-ai/langchain