GMailLoader#

class langchain_community.chat_loaders.gmail.GMailLoader(creds: Any, n: int = 100, raise_error: bool = False)[source]#

Deprecated since version 0.0.32: Use :class:`~langchain_google_community.GMailLoader` instead. It will be removed in None==1.0.

Load data from GMail.

There are many ways you could want to load data from GMail. This loader is currently fairly opinionated in how to do so. The way it does it is it first looks for all messages that you have sent. It then looks for messages where you are responding to a previous email. It then fetches that previous email, and creates a training example of that email, followed by your email.

Note that there are clear limitations here. For example, all examples created are only looking at the previous email for context.

To use:

  • Set up a Google Developer Account:

    Go to the Google Developer Console, create a project, and enable the Gmail API for that project. This will give you a credentials.json file that youโ€™ll need later.

Methods

__init__(creds[,ย n,ย raise_error])

lazy_load()

Lazy load the chat sessions.

load()

Eagerly load the chat sessions into memory.

Parameters:
  • creds (Any)

  • n (int)

  • raise_error (bool)

__init__(creds: Any, n: int = 100, raise_error: bool = False) โ†’ None[source]#
Parameters:
  • creds (Any)

  • n (int)

  • raise_error (bool)

Return type:

None

lazy_load() โ†’ Iterator[ChatSession][source]#

Lazy load the chat sessions.

Returns:

An iterator of 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 GMailLoader