WhatsAppChatLoader#

class langchain_community.chat_loaders.whatsapp.WhatsAppChatLoader(path: str)[source]#

Load WhatsApp conversations from a dump zip file or directory.

Initialize the WhatsAppChatLoader.

Parameters:

path (str) – Path to the exported WhatsApp chat zip directory, folder, or file.

To generate the dump, open the chat, click the three dots in the top right corner, and select “More”. Then select “Export chat” and choose “Without media”.

Methods

__init__(path)

Initialize the WhatsAppChatLoader.

lazy_load()

Lazy load the messages from the chat file and yield them as chat sessions.

load()

Eagerly load the chat sessions into memory.

__init__(path: str)[source]#

Initialize the WhatsAppChatLoader.

Parameters:

path (str) – Path to the exported WhatsApp chat zip directory, folder, or file.

To generate the dump, open the chat, click the three dots in the top right corner, and select “More”. Then select “Export chat” and choose “Without media”.

lazy_load() Iterator[ChatSession][source]#

Lazy load the messages from the chat file and yield them as chat sessions.

Yields:

Iterator[ChatSession] – The loaded chat sessions.

Return type:

Iterator[ChatSession]

load() list[ChatSession]#

Eagerly load the chat sessions into memory.

Returns:

A list of chat sessions.

Return type:

list[ChatSession]

Examples using WhatsAppChatLoader