Vertex AI サービスを初期化するときに、サービスを実行してモデルにアクセスするロケーションを指定できます(省略可)。ロケーションを指定しない場合、デフォルトは us-central1
です。利用可能なロケーションの一覧については、このページの後半をご覧ください。
コードサンプル
これらのサンプルでは Gemini モデルへのアクセスを示していますが、Imagen 3 モデルにアクセスするときにロケーションを指定することもできます。
import FirebaseVertexAI
// Initialize the Vertex AI service
// Optionally specify a location in which to run the service and access the model
let vertex = VertexAI.vertexAI(location: "LOCATION ")
// Initialize the generative model with a model that supports your use case
let model = vertex.generativeModel(modelName: "MODEL_NAME ")
// Initialize the Vertex AI service
// Optionally specify a location in which to run the service and access the model
val vertexAI = Firebase.vertexAI(location = "LOCATION ")
// Initialize the generative model with a model that supports your use case
val generativeModel = vertexAI.generativeModel(modelName = "MODEL_NAME ")
// Initialize the Vertex AI service
// Optionally specify a location in which to run the service and access the model
FirebaseVertexAI vertexAI = FirebaseVertexAI.getInstance("LOCATION ");
// Initialize the generative model 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);
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
// Optionally specify a location in which to run the service and access the model
const vertexAI = getVertexAI(firebaseApp, { location: 'LOCATION ' });
// Initialize the generative model with a model that supports your use case
const model = getGenerativeModel(vertexAI, { model: 'MODEL_NAME ' });
import 'package:firebase_vertexai/firebase_vertexai.dart';
import 'package:firebase_core/firebase_core.dart';
// Initialize FirebaseApp
await Firebase.initializeApp();
// Initialize FirebaseVertexAI instance
// Optionally specify a location in which to run the service and access the model
final vertexAI = await FirebaseVertexAI.instanceFor(location: 'LOCATION ');
// Initialize the Vertex AI service and the generative model
// Specify a model that supports your use case
final model = vertexAI.generativeModel(model: 'MODEL_NAME ');
利用できるロケーション
Google Cloud は、リージョンを使用してリージョン API を定義します。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
)