Google Drive Actions
Let an assistant perform actions to Google Drive.
Prerequisites
This guide helps you to set up an assistant action for Google Drive. Before proceeding, we recommend reading the following guide: Assistant actions.
The assistant action allows you to list and query files, load the file content into the assistant, and use it as additional context. If you want to attach specific files or sheets to an assistant, we recommend using our Google Drive Search Integration and attaching the file to the assistant knowledge. If you are a Langdock admin, please refer to this workspace-level integration guide. If you are not an admin, please refer to this guide.
Make sure to read the API documentation from Google Drive. Also, you need to have a Google Cloud account and enable the Drive API (if not already enabled). To enable the API, follow these steps:
-
Create Google Cloud project
-
Enable the Google Drive API from the Google API Library
-
If the Publishing status is Testing, add users to your application
Setup
1. Assistant instructions
Create a new assistant. If you are new to creating assistants, you can read more about how to create assistants and write instructions in our assistant guide and our prompt engineering guide. Paste the following instructions into the according field.
You can add other actions from the other methods described in the Google Drive API.
2. OpenAPI Schema
Scroll to the bottom of the assistant configuration and click on New Action. Here you can configure actions and API requests to other tools. Copy the text below into the field OpenAPI Schema. You can also try out action assistant to write the OpenAPI schema.
With the Google Drive API, the get
method will lead to the model trying to download the file, which is not possible. Instead, use export
.
Authentication
3. Google Drive Configuration
-
Go to your Google Cloud Console
-
Navigate to Enabled API & Services. Then, go to the Library and enable Google Drive API
- Use the search bar to search Google Drive API
- Now, create new OAuth credentials. You might need to set up an OAuth credentials screen if you have not done so already.
-
Allow the app the according permissions for the methods mentioned above.
-
Establish the primary tester as a testing email (if testing is enabled).
-
Set the OAuth rate limit.
-
Afterward, go to Credentials and click + Create Credentials and then Create Credentials.
- Afterward, copy and save the OAuth Client ID and the Client Secret.
4. OAuth Configuration in Langdock
At the top of the action settings you find a section called Authentication. Select OAuth.
Enter the according information from your Google Drive Configuration:
-
Client ID: Paste the Client ID from above
-
Client Secret: Paste the Client Secret from before
-
Authorization URL: https://accounts.google.com/o/oauth2/auth
-
Token URL: https://oauth2.googleapis.com/token
-
Scope: https://www.googleapis.com/auth/drive
- For a list of more detailed scopes enabled, please refer to Google’s OAuth 2.0 guide.
-
Token: Default
5. Paste redirect URL into Google Drive
-
Copy the redirect URL from the OAuth section in the action.
-
Go to Google Drive and paste it in the Authorized redirect URIs.
Was this page helpful?