Toggle Menu
Prev Up Next

# `langchain_community.chat_loaders.utils`.merge_chat_runs

langchain_community.chat_loaders.utils.merge_chat_runs(chat_sessions: Iterable[ChatSession]) → Iterator[ChatSession]

  Merge chat runs together.

  A chat run is a sequence of messages from the same sender.

  Parameters

    chat_sessions (Iterable[ChatSession]) – A list of chat sessions.

  Returns

    A list of chat sessions with merged chat runs.

  Return type

    Iterator[ChatSession]

# Examples using merge_chat_runs

- Merge consecutive messages from the same sender into a single message

- This uses some example data