|
คลิกผู้ให้บริการ Gemini API เพื่อดูเนื้อหาและโค้ดของผู้ให้บริการรายนั้นๆ ในหน้านี้ |
โมเดล Generative AI ของ Google พร้อมให้บริการในบางภูมิภาค
เมื่อเริ่มต้นบริการแบ็กเอนด์ Vertex AI Gemini API ในโค้ด คุณสามารถระบุตำแหน่งของโมเดลที่กำลังเข้าถึง ในคำขอได้โดยไม่บังคับ ดูรายการสถานที่ที่พร้อมให้บริการในหน้านี้
ข้อเท็จจริงและแนวทางปฏิบัติแนะนำที่สำคัญเกี่ยวกับสถานที่ตั้งมีดังนี้
ขีดจำกัดความจุจะต่อภูมิภาค ต่อนาที และต่อโมเดล
หากไม่ได้ระบุสถานที่ตั้ง ค่าเริ่มต้นจะเป็น
us-central1เราขอแนะนำให้ตั้งค่า location เป็น
globalในคำขอเพื่อหลีกเลี่ยงการใช้งานจนถึงขีดจำกัดความจุโดยไม่คาดคิดหากการตั้งค่าตำแหน่งเป็น
globalไม่เกี่ยวข้องกับ Use Case ของคุณ ให้พิจารณาการแจกจ่ายอย่างชัดเจนในที่ที่คุณเข้าถึงโมเดล เช่น คุณสามารถ ตั้งค่าสถานที่ตั้งตามสถานที่ตั้งของผู้ใช้ปลายทางได้โดยใช้ Firebase Remote Config
ดูข้อมูลเกี่ยวกับglobalตำแหน่ง
สำหรับการเข้าถึงโมเดลเกือบทั้งหมด GeminiVertex AI Gemini API รองรับglobalตำแหน่ง ซึ่งหมายความว่าคำขอของคุณจะได้รับการจัดการโดยโมเดลที่พร้อมใช้งานทุกที่ในพูลทั่วโลก
การตั้งค่าสถานที่ตั้งเป็น global สำหรับคำขอจะช่วยให้คุณหลีกเลี่ยงการเกินขีดจำกัดความจุของโมเดลและลดข้อผิดพลาดทรัพยากรหมด (429) ได้
ตัวอย่างโค้ด
โปรดทราบว่าตัวอย่างเหล่านี้แสดงการเข้าถึงโมเดล Gemini แต่คุณยังระบุตำแหน่งเมื่อเข้าถึงโมเดล Imagen ได้ด้วย
แทนที่ LOCATION ด้วยรหัสสถานที่ (เช่น europe-west4)
จากรายการสถานที่ที่พร้อมให้บริการในหน้านี้ในภายหลัง
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");
// ...
โปรดทราบว่าหากคุณระบุตำแหน่งที่โมเดลไม่พร้อมใช้งาน คุณจะได้รับข้อผิดพลาด 404 ที่ระบุว่าโมเดลwas not found or your project does not have access to it
ประเทศที่ให้บริการ
Google Cloud ใช้ ภูมิภาค Google Cloud จะจัดเก็บข้อมูลลูกค้าในภูมิภาคที่คุณระบุสำหรับฟีเจอร์ Generative AI ที่พร้อมให้บริการโดยทั่วไปทั้งหมดใน Vertex AI เท่านั้น
Generative AI ใน Vertex AI พร้อมให้บริการในภูมิภาคต่อไปนี้ บางรุ่นและ/หรือบางเวอร์ชันอาจไม่พร้อมใช้งานในบางพื้นที่ (ดูความพร้อมให้บริการโดยละเอียดได้ในGoogle Cloudเอกสารประกอบ)
โมเดล Gemini ทั้งหมด (ยกเว้นโมเดล Gemini Live) ยังพร้อมให้บริการในglobal ด้วย สำหรับโมเดล Imagen ระบบไม่รองรับตำแหน่ง global
สหรัฐอเมริกา
- โคลัมบัส โอไฮโอ (
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)