Model AI generatif Google diekspos menggunakan endpoint regional tertentu.
Saat melakukan inisialisasi layanan Vertex AI, Anda dapat secara opsional menentukan
lokasi endpoint untuk model yang Anda akses dalam permintaan. Jika Anda
tidak menentukan lokasi, defaultnya adalah us-central1
. Lihat daftar
lokasi yang tersedia nanti di halaman ini.
Vertex AI in Firebase belum mendukung endpoint global untuk Vertex AI.
Contoh kode
Perhatikan bahwa contoh ini menunjukkan akses ke model Gemini, tetapi Anda juga dapat menentukan lokasi saat mengakses model Imagen 3.
Ganti LOCATION dengan kode lokasi (misalnya, europe-west4
)
dari daftar lokasi yang tersedia nanti di halaman ini.
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');
Lokasi yang tersedia
Google Cloud menggunakan region untuk menentukan endpoint regional. Google Cloud hanya menyimpan data pelanggan di region yang Anda tentukan untuk semua fitur AI Generatif yang tersedia secara umum di Vertex AI.
AI Generatif di Vertex AI tersedia di wilayah berikut. Beberapa model dan/atau versi tertentu mungkin hanya tersedia di lokasi tertentu (untuk mengetahui ketersediaan lokasi secara mendetail, lihat dokumentasi Google Cloud).
Amerika Serikat
- Columbus, Ohio (
us-east5
) - Dallas, Texas (
us-south1
) - Iowa (
us-central1
) - Las Vegas, Nevada (
us-west4
) - Moncks Corner, South Carolina (
us-east1
) - Northern Virginia (
us-east4
) - Oregon (
us-west1
)
Kanada
- Montréal (
northamerica-northeast1
)
Amerika Selatan
- Sao Paulo, Brasil (
southamerica-east1
)
Eropa
- Belgia (
europe-west1
) - Finlandia (
europe-north1
) - Frankfurt, Jerman (
europe-west3
) - London, Inggris Raya (
europe-west2
) - Madrid, Spanyol (
europe-southwest1
) - Milan, Italia (
europe-west8
) - Belanda (
europe-west4
) - Paris, Prancis (
europe-west9
) - Warsaw, Polandia (
europe-central2
) - Zürich, Swiss (
europe-west6
)
Asia Pasifik
- Changhua County, Taiwan (
asia-east1
) - Hong Kong, China (
asia-east2
) - Mumbai, India (
asia-south1
) - Seoul, Korea (
asia-northeast3
) - Singapura (
asia-southeast1
) - Sydney, Australia (
australia-southeast1
) - Tokyo, Jepang (
asia-northeast1
)
Timur Tengah
- Dammam, Arab Saudi (
me-central2
) - Doha, Qatar (
me-central1
) - Tel Aviv, Israel (
me-west1
)