0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

watsonx OrchestrateからGoogle Driveを呼び出してみよう

Last updated at Posted at 2025-10-06

このブログで紹介する内容について

Watsonx Orchestrateの接続から必要な情報を記載しGoogle Driveと接続、watsonx OrchestrateのプリビルドツールとしてGoogle Driveをエージェントに追加してファイルをMy Drive上に作成する手順について説明します。

Googleのアカウント作成

https://www.google.com にアクセスし、新規アカウントを作成・ログインします。

Google CloudでクライアントID・シークレットを取得

https://console.cloud.google.com にアクセスし、プロジェクトの選択をクリックします。
Google API vs wxo_01.png

下記の画面に遷移するので新しいプロジェクトをクリックします。
Google API vs wxo_02.png

任意のプロジェクト名を入力し、作成をクリックします。
Google API vs wxo_03.png

APIとサービスを選択し、OAuth同意画面をクリックします。
Google API vs wxo_04.png

クライアントを選択し、プロジェクトを選択します。
Google API vs wxo_05.png

下記の項目を画面に従って入力をし作成をクリックします。
Google API vs wxo_06.png
Google API vs wxo_07.png
Google API vs wxo_08.png
Google API vs wxo_09.png

クライアントを選択し、クライアントを作成をクリックします。
Google API vs wxo_12.png

アプリケーションの種類名前に任意の名称をつけて作成をクリックします。
Google API vs wxo_13.png

クライアントIDクライアントシークレットが作成されるので文字列を保存しておきます。OKをクリックして画面を閉じ、承認済みのリダイレクトURIhttps://developers.google.com/oauthplayground と入力して保存をクリックします。
Google API vs wxo_14.png
Google API vs wxo_15.png

Google Cloudにデータアクセスの権限を与える

データアクセスを選択、スコープを追加または削除をクリックします。
Google API vs wxo_16.png

選択したスコープの更新が開くので、必要なスコープを選択します。今回はすべてのスコープを追加しています。Saveをクリックします。
Google API vs wxo_17.png
Google API vs wxo_18.png
Google API vs wxo_19.png

対象を選択し、テストユーザーの**+ Add users**をクリックし、現在のGoogleのメールアドレスを追加します。
Google API vs wxo_23.png

OAuth 2.0 PlaygroundでTokenを取得する

https://developers.google.com/oauthplayground にアクセスし、右上の設定(歯車)マークをクリックします。

Use your own OAuth credentialsONにし、OAuth Client ID / Secret を入力、Access typeofflineにし、Force promptconsent Screemにします。

Step1 Select & authorized APIsにGoogle DriveのAPIを選択するか、左下の赤枠の入力欄にhttps://www.googleapis.com/auth/drive と記入し、Authorize APIsをクリックします。

Google API vs wxo_22.png

Step 2 Exchange authorization code for tokensが開き、Exchange authorization code for tokensをクリックします。
Refresh tokenAccess tokenを取得してテキストとして保存しておきます。
このときAuto-refresh the token vefore it expires. にチェックを入れておくとトークンの期限切れを防ぐことができます。
Google API vs wxo_24.png
Google API vs wxo_25.png

watsonx OrchestrateからGoogle Driveのファイルを作成してみる

watsonx Orchestrateを開き、左上のハンバーグマークをクリック管理接続をクリックします。
Google API vs wxo_34.png

Google API vs wxo_35.png

「Google」で検索し、google_key_value_ibm_184bdbd3の右にある鉛筆マークをクリックします。
Google API vs wxo_27.png

テスト用ではドラフト、本番用ではLiveを選択し(今回はドラフト)、SSOはOff、認証タイプはKey Value Pair、Base UrIにhttps://www.googleapis.com/auth/drive 、Token URIにhttps://oauth2.googleapis.com/token 、Client ID /Secret, Bearer Token, Refresh Tokenに先ほど保存したテキストを入力し、接続をクリックすると接続済みの表示となるので保存をクリックします。
Google API vs wxo_26.png

次にエージェントを作成します。左上のハンバーガーマークからビルド→エージェント・ビルダーをクリックします。
Google API vs wxo_36.png

エージェントの作成画面になるので名前説明を記述しテンプレートから作成をクリックします。
Google API vs wxo_28.png

知識を選択しツールの追加をクリックします。
Google API vs wxo_29.png

カタログから追加をクリックします。
Google API vs wxo_37.png

アプリ欄からGoogleにチェックをいれ、Create a folder in Google Drive
をクリックし、概要の画面が開くのでエージェントに追加をクリックします。
Google API vs wxo_30.png
Google API vs wxo_38.png

エージェントのプレビュー画面で次の文章を入力します。
Google DriveでMy Driveの中に"Google test"フォルダを作って。
Google API vs wxo_33.png

Google DriveのMy Driveの中にGoogle testフォルダが作成されたことを確認できました。
Google API vs wxo_32.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?