python3 main_agents.py
... will start a conversation where the chatbot has access and can perform functions on a Google SpreadSheet.
For authentification with Google and the Agents SDK:
pip install openai-agents oauth2client
To be used by the agents:
pip install gspread # This will be used by the agents
-
Set Up Google Sheets API:
- Go to the Google Cloud Console.
- Create a new project.
- Enable the Google Sheets API for this project.
- Create credentials: Choose "Service account" and download the JSON key file. This file is crucial for authenticating API requests.
-
Share Spreadsheet with Service Account:
- Open your Google Spreadsheet.
- Share it with the service account email (found in your JSON credentials file). This is necessary to allow the service account to access the spreadsheet.
-
Set Variables:
- In
sheets.py, set the file path of the JSON credentials infrom_json_keyfile_name(). - also in
sheets.py, set the name of the Google Spreadsheet inclient.open().
- In
- Set up OpenAI API:
- Go to API Keys on the OpenAI Platform.
- Create new key and set the key as an environment variable
export OPENAI_API_KEY=<key>. - Fund the key if needed.