Google Drive API
.
Prerequisites
- Create a Google Cloud project or use an existing project
- Enable the Google Drive API
- Authorize credentials for desktop app
pip install -U google-api-python-client google-auth-httplib2 google-auth-oauthlib
Instructions for retrieving your Google Docs data
By default, theGoogleDriveTools
and GoogleDriveWrapper
expects the credentials.json
file to be ~/.credentials/credentials.json
, but this is configurable by setting the GOOGLE_ACCOUNT_FILE
environment variable to your custom/path/to/credentials.json
.
The location of token.json
use the same directory (or use the parameter token_path
). Note that token.json
will be created automatically the first time you use the tool.
GoogleDriveSearchTool
can retrieve a selection of files with some requests.
By default, If you use a folder_id
, all the files inside this folder can be retrieved to Document
, if the name match the query.
- Folder: drive.google.com/drive/u/0/folders/1yucgL9WGgWZdM1TOuKkeghlPizuzMYb5 -> folder id is
"1yucgL9WGgWZdM1TOuKkeghlPizuzMYb5"
- Document: docs.google.com/document/d/1bfaMQ18_i56204VaQDVeAFpqEijJTgvurupdEDiaUQw/edit -> document id is
"1bfaMQ18_i56204VaQDVeAFpqEijJTgvurupdEDiaUQw"
root
is for your personal home.
Document
.
- text/text
- text/plain
- text/html
- text/csv
- text/markdown
- image/png
- image/jpeg
- application/epub+zip
- application/pdf
- application/rtf
- application/vnd.google-apps.document (GDoc)
- application/vnd.google-apps.presentation (GSlide)
- application/vnd.google-apps.spreadsheet (GSheet)
- application/vnd.google.colaboratory (Notebook colab)
- application/vnd.openxmlformats-officedocument.presentationml.presentation (PPTX)
- application/vnd.openxmlformats-officedocument.wordprocessingml.document (DOCX)
GoogleDriveAPIWrapper
.
But, the corresponding packages must installed.
Use the tool within a ReAct agent
In order to create an agent that uses the Google Jobs tool install LangGraphcreate_agent
functionality to initialize a ReAct agent. You will also need to set up your OPEN_API_KEY (visit platform.openai.com) in order to access OpenAI’s chat models.