# Vertex AIのセットアップ

## 設定方法

BigQueryコンソールで以下の操作を行います:

* 「外部接続」の追加
  * エクスプローラの「データを追加」から `Vertex AI > BigQueryフェデレーション` を追加します
* 「外部接続」へのアクセス権の追加
  * 「IAMと管理」からアクセス権を付与します
    * 「アクセスを許可」を押し、「プリンシパルの追加」の「新しいプリンシパル」に 追加した「外部接続」のサービスアカウントIDを入力します
    * `Vertex AI ユーザー` ロールを割り当てます
* Codatumコネクションへ以下のロールを追加します:
  * `BigQuery Connection User`
  * 追加には以下の2種類の方法があります:
    * 外部接続に対して、プリンシパルを追加します
      * 「外部接続」から追加した外部接続を選択し、「共有 > プリンシパルを追加」にCodatumコネクションに利用しているサービスアカウントを入力します
    * Codatumコネクションに設定されているサービスアカウントにロールを追加します
      * 「IAMと管理」からCodatumコネクションに利用しているサービスアカウントを選択し、「ロールを割り当てる」からロールを追加します
* データセットの作成
  * モデルを登録するデータセットを作成します
* (オプション)モデルの追加
  * BigQueryのクエリエディタからモデルを追加します。参考：[Gemini モデルと ML.GENERATE\_TEXT 関数を使用してテキストを生成する](https://cloud.google.com/bigquery/docs/generate-text-tutorial-gemini?hl=ja)
  * モデルの追加はCodatum上で実行できます


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codatum.jp/best-practices/ai-generated-summary/vertex-ai-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
