|
Klik penyedia Gemini API untuk melihat konten dan kode khusus penyedia di halaman ini. |
Model AI generatif Google tersedia di region tertentu.
Saat melakukan inisialisasi layanan backend Vertex AI Gemini API di kode, Anda dapat secara opsional menentukan lokasi model yang Anda akses dalam permintaan. Lihat daftar lokasi yang tersedia di bagian berikutnya halaman ini.
Berikut beberapa fakta utama dan praktik terbaik tentang lokasi:
Batas kapasitas adalah per model, per region, per menit.
Jika Anda tidak menentukan lokasi, defaultnya adalah
us-central1.Untuk menghindari tercapainya batas kapasitas secara tidak terduga, sebaiknya tetapkan lokasi ke
globaldalam permintaan Anda.Jika menyetel lokasi ke
globaltidak berlaku untuk kasus penggunaan Anda, pertimbangkan untuk mendistribusikan secara eksplisit tempat Anda mengakses model. Misalnya, Anda dapat menetapkan lokasi berdasarkan lokasi pengguna akhir Anda menggunakan Firebase Remote Config.
Mempelajari lokasi global
Untuk mengakses hampir semua model Gemini, Vertex AI Gemini API mendukung lokasi global, yang berarti permintaan Anda akan ditangani oleh model yang tersedia di mana pun dalam kumpulan global.
Menetapkan lokasi ke global untuk permintaan Anda dapat membantu Anda menghindari batas kapasitas model dan mengurangi error kehabisan resource (429).
Contoh kode
Perhatikan bahwa contoh ini menunjukkan cara mengakses model Gemini, tetapi Anda juga dapat menentukan lokasi saat mengakses model Imagen.
Ganti LOCATION dengan kode lokasi (misalnya, europe-west4)
dari daftar lokasi yang tersedia di halaman ini.
Swift
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify the location for where you want to access the model
let ai = FirebaseAI.firebaseAI(backend: .vertexAI(location: "LOCATION"))
// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(modelName: "MODEL_NAME")
// ...
Kotlin
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify the location for where you want to access the model
val model = Firebase.ai(backend = GenerativeBackend.vertexAI(location = "LOCATION"))
.generativeModel("MODEL_NAME")
// ...
Java
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify the location for where you want to access the model
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI("LOCATION"))
.generativeModel("MODEL_NAME");
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
// ...
Web
// ...
// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);
// Initialize the Vertex AI Gemini API backend service
// Specify the location for where you want to access the model
const ai = getAI(firebaseApp, { backend: new VertexAIBackend('LOCATION') });
// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(ai, { model: 'MODEL_NAME' });
// ...
Dart
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify the location for where you want to access the model
final ai = await FirebaseAI.vertexAI(location: 'LOCATION');
// Create a `GenerativeModel` instance with a model that supports your use case
final model = ai.generativeModel(model: 'MODEL_NAME');
// ...
Unity
// ...
// Initialize the Vertex AI Gemini API backend service
// Specify the location for where you want to access the model
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.VertexAI(location: "LOCATION"));
// Create a `GenerativeModel` instance with a model that supports your use case
var model = ai.GetGenerativeModel(modelName: "MODEL_NAME");
// ...
Perhatikan bahwa jika Anda menentukan lokasi tempat model tidak tersedia, Anda akan mendapatkan
error 404 yang menyatakan bahwa model
was not found or your project does not have access to it.
Lokasi yang tersedia
Google Cloud menggunakan wilayah. Google Cloud hanya menyimpan data pelanggan di region yang Anda tentukan untuk semua fitur yang tersedia secara umum dari AI Generatif 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 ketersediaan lokasi yang mendetail, lihat dokumentasi Google Cloud).
Semua model Gemini (kecuali model Gemini Live) juga tersedia di lokasi
global. Untuk model Imagen, lokasi global
tidak didukung.
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) - Warsawa, 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)