LangChain · Function
merge_message_runs
Merges adjacent messages of the same type into one message. Tool messages are kept separate because their tool call IDs cannot be merged.
Last updated
- Since
- v1.7
Syntax
merge_message_runs(messages: Iterable[MessageLikeRepresentation] | PromptValue, *, chunk_separator: str = '\n') -> list[BaseMessage]In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
BaseMessageMessageLikeRepresentationPromptValueHumanMessageAIMessageSystemMessageToolMessage