Notebooks
O
OpenAI
Gpt Action Google Drive

Gpt Action Google Drive

chatgptgpt_actions_libraryopenaigpt-4examplesopenai-apiopenai-cookbook

GPT Action Library: Google Drive

Introduction

This page provides an instruction & guide for developers building a GPT Action for a specific application. Before you proceed, make sure to first familiarize yourself with the following information:

This particular GPT Action provides an overview of how to connect to Google Drive, Google’s File storage system. This action will allow you to list and query against file names, load the file content into your GPT, and ultimately use that data as context in ChatGPT. This set of actions is extensible by additional methods found via the Google Drive API. This is great if you want a generalist GPT that can read smaller files, such as:

  • Meetings minutes
  • Product design documents
  • Short memos
  • Frequently-asked questions

For something that wants to read longer memos such as entire books, complex CSVs with many rows, we suggest building a Google Docs or Google Sheets-specific GPT.

Value + Example business case

Users can now leverage ChatGPT's natural language capability to connect directly to files in Google Drive

Example Use Cases:

  • A user needs to look up which files relate to a certain topic
  • A user needs an answer to a critical question, buried deep in documents

Application Information

Application Key Links

Check out these links from the application before you get started:

Application Prerequisites

Before you get started, make sure you have a Google Cloud account and that the Drive API is enabled:

  • Set up a Google Cloud project
  • Enable Google Drive API from Google API Library
  • If application’s “Publishing Status” is “Testing”, ensure users are added to your application

ChatGPT Steps

Example Custom GPT Instructions

Once you've created a Custom GPT, to get started, copy the text below in the Instructions panel. You may have to add additional context specific to your use case. In this way, it is worth testing additional instructions you add to optimize for clarity and accuracy. Have questions? Check out Getting Started Example to see how this step works in more detail.

[ ]

Example OpenAPI Schema

Once you've created a Custom GPT, copy the text below in the Actions panel. This offers an example of what you could include as functions of your GPT.

Have questions? Check out Getting Started Example to see how this step works in more detail. As well, try ActionsGPT, a CustomGPT OpenAI created to help with Actions. The three examples are:

  • List Files: this is the core action that lists the files in your drive. Within this are a few parameters, such as q, includeItemsFromAllDrives,supportsAllDrives
  • Get Metadata: in case list doesn't work, this can offer as a backup based on certain results - for example, if users attempt to make a search via “meeting from last week”, etc
  • Export: exports in a byte content. For more reading, please consult https://developers.google.com/drive/api/reference/rest/v3/files/export

Generally, if ‘get’ is used, the model will attempt to download the file, which may be undesirable. Thus, Export is recommended instead.

[ ]

Authentication Instructions

Below are instructions on setting up authentication with this 3rd party application. Have questions? Check out Getting Started Example to see how this step works in more detail.

Pre-Action Steps

Before you set up authentication in ChatGPT, please take the following steps in the application.

  • Go to the Google Cloud Console
  • Navigate to Enabled API & Services and enable Google Drive API

alt_text

alt_text

  • Within the search bar, search Google Drive API:

alt_text

  • Create new OAuth credentials (or use an existing one). Note that if you haven’t set up an OAuth credentials screen, you will need to do that.

alt_text

  • Within this process, you will need to grant access to the correct permissions, establish the primary tester as a testing email if Testing is enabled, and set up the OAuth rate limit.
  • Next, go to credentials and click “+ Create Credentials” and click “Create Credentials”. Below is an example of what this screen looks like when it’s already set up.

alt_text

  • Locate your OAuth Client ID & Client Secret and store both values securely (see screenshot below)

alt_text

In ChatGPT

In ChatGPT, click on "Authentication" and choose "OAuth". Enter in the information below.

Post-Action Steps

Once you've set up authentication in ChatGPT, follow the steps below in the application to finalize the Action.

  • Copy the callback URL from the GPT Action

alt_text

  • In the “Authorized redirect URIs”, add your callback URL

alt_text

FAQ & Troubleshooting

  • Callback URL Error: If you get a callback URL error in ChatGPT, pay close attention to the screenshot above. You need to add the callback URL directly into GCP for the action to authenticate correctly.

Are there integrations that you’d like us to prioritize? Are there errors in our integrations? File a PR or issue in our GitHub, and we’ll take a look.

gd2md-html: xyzzy Mon Aug 12 2024