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
- Go to the Google Cloud Console.
- Create a project if you don’t have one already.
- Create an
OAuth Consent Screenin the project. You may need to select theexternaloption. - Make sure the consent screen is published.
- Enable the Gmail API
- Create credentials from the
Credentialstab. - Select the type
OAuth Client ID. - Choose the application type
Web application. As a name you can chooseembedchainor any other name as per your use case. - Add an authorized redirect URI for
http://localhost:8080/. - You can leave everything else at default, finish the creation.
- When you are done, a modal opens where you can download the details in
jsonformat. - Put the
.jsonfile in your current directory and rename it tocredentials.json