Google の生成 AI モデルは、特定のリージョン エンドポイントを使用して公開されます。
Vertex AI サービスを初期化するときに、リクエストでアクセスするモデルのエンドポイント ロケーションを必要に応じて指定できます。ロケーションを指定しない場合、デフォルトは us-central1
です。利用可能なロケーションの一覧については、このページの後半をご覧ください。
Vertex AI in Firebase は、Vertex AI のグローバル エンドポイントをまだサポートしていません。
コードサンプル
これらのサンプルでは Gemini モデルへのアクセスを示していますが、Imagen 3 モデルにアクセスするときにロケーションを指定することもできます。
LOCATION は、このページの後半の利用可能なロケーションのリストにあるロケーション コード(europe-west4
など)に置き換えます。
Swift
import FirebaseVertexAI
// Initialize the Vertex AI service
// Specify the endpoint location for the model accessed by your requests
let vertex = VertexAI.vertexAI(location: "LOCATION")
// Create a `GenerativeModel` instance with a model that supports your use case
let model = vertex.generativeModel(modelName: "MODEL_NAME")
Kotlin
// Initialize the Vertex AI service
// Specify the endpoint location for the model accessed by your requests
val vertexAI = Firebase.vertexAI(location = "LOCATION")
// Create a `GenerativeModel` instance with a model that supports your use case
val generativeModel = vertexAI.generativeModel(modelName = "MODEL_NAME")
Java
// Initialize the Vertex AI service
// Specify the endpoint location for the model accessed by your requests
FirebaseVertexAI vertexAI = FirebaseVertexAI.getInstance("LOCATION");
// Create a `GenerativeModel` instance with a model that supports your use case
GenerativeModel gm = vertexAI.generativeModel("MODEL_NAME");
// Use the `GenerativeModelFutures` Java compatibility layer which offers
// support for `ListenableFuture` and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(gm);
Web
import { initializeApp } from "firebase/app";
import { getVertexAI, getGenerativeModel } from "firebase/vertexai";
// TODO(developer) Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
// ...
};
// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);
// Initialize the Vertex AI service
// Specify the endpoint location for the model accessed by your requests
const vertexAI = getVertexAI(firebaseApp, { location: 'LOCATION' });
// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(vertexAI, { model: 'MODEL_NAME' });
Dart
import 'package:firebase_vertexai/firebase_vertexai.dart';
import 'package:firebase_core/firebase_core.dart';
// Initialize FirebaseApp
await Firebase.initializeApp();
// Initialize the Vertex AI service
// Specify the endpoint location for the model accessed by your requests
final vertexAI = await FirebaseVertexAI.instanceFor(location: 'LOCATION');
// Create a `GenerativeModel` instance with a model that supports your use case
final model = vertexAI.generativeModel(model: 'MODEL_NAME');
利用できるロケーション
Google Cloud は、リージョンを使用してリージョン エンドポイントを定義します。Google Cloud は、Vertex AI の生成 AI のすべての一般提供機能に指定したリージョンにのみ顧客データを保存します。
Vertex AI の生成 AI は、次のリージョンで利用できます。一部のモデルや特定のバージョンは、地域によってはご利用いただけない場合があります(利用可能な地域の詳細については、Google Cloud のドキュメントをご覧ください)。
米国
- オハイオ州コロンバス(
us-east5
) - テキサス州ダラス(
us-south1
) - アイオワ(
us-central1
) - ラスベガス、ネバダ州(
us-west4
) - モンクスコーナー、サウスカロライナ州(
us-east1
) - 北バージニア(
us-east4
) - オレゴン(
us-west1
)
カナダ
- モントリオール(
northamerica-northeast1
)
南アメリカ
- サンパウロ、ブラジル(
southamerica-east1
)
ヨーロッパ
- ベルギー(
europe-west1
) - フィンランド(
europe-north1
) - フランクフルト、ドイツ(
europe-west3
) - ロンドン、イギリス(
europe-west2
) - マドリード、スペイン(
europe-southwest1
) - ミラン、イタリア(
europe-west8
) - オランダ(
europe-west4
) - パリ、フランス(
europe-west9
) - ワルシャワ、ポーランド(
europe-central2
) - チューリッヒ、スイス(
europe-west6
)
アジア太平洋
- 彰化県、台湾(
asia-east1
) - 香港、中国(
asia-east2
) - ムンバイ、インド(
asia-south1
) - ソウル、韓国(
asia-northeast3
) - シンガポール(
asia-southeast1
) - シドニー、オーストラリア(
australia-southeast1
) - 東京、日本(
asia-northeast1
)
中東
- ダンマーム、サウジアラビア(
me-central2
) - ドーハ、カタール(
me-central1
) - テルアビブ、イスラエル(
me-west1
)