embedchain/docs/components/data-sources/gmail.mdx
To use GmailLoader you must install the extra dependencies with pip install --upgrade embedchain[gmail].
The source must be a valid Gmail search query, you can refer https://support.google.com/mail/answer/7190?hl=en to build a query.
To load Gmail messages, you MUST use the data_type as gmail. Otherwise the source will be detected as simple text.
To use this you need to save credentials.json in the directory from where you will run the loader. Follow these steps to get the credentials
OAuth Consent Screen in the project. You may need to select the external option.Credentials tab.OAuth Client ID.Web application. As a name you can choose embedchain or any other name as per your use case.http://localhost:8080/.json format..json file in your current directory and rename it to credentials.jsonfrom embedchain import App
app = App()
gmail_filter = "to: me label:inbox"
app.add(gmail_filter, data_type="gmail")
app.query("Summarize my email conversations")