|
คลิกผู้ให้บริการ Gemini API เพื่อดูเนื้อหาเฉพาะของผู้ให้บริการ และโค้ดในหน้านี้ |
โมเดล Generative AI ของ Google พร้อมให้บริการในบางภูมิภาค คุณสามารถเลือกตำแหน่งที่จะเข้าถึงโมเดลเพื่อให้เป็นไปตามข้อกำหนดด้านการปฏิบัติตามข้อกำหนด เวลาในการตอบสนอง ความพร้อมใช้งาน และความทนทาน
เมื่อใช้ Firebase AI Logic แต่ละคำขอที่ใช้ Agent Platform Gemini API (formerly Vertex AI) จะมีข้อมูลตำแหน่งที่จะเข้าถึง โมเดลได้โดยไม่บังคับ Firebase AI Logic มีการตั้งค่าตำแหน่งเริ่มต้น
- เมื่อใช้ไวยากรณ์การเริ่มต้น "Agent Platform" ใหม่:
global - เมื่อใช้ไวยากรณ์การเริ่มต้น "Vertex AI" แบบเดิม:
us-central1
สำหรับโมเดล Gemini เกือบทั้งหมด Agent Platform Gemini API (formerly Vertex AI) รองรับ
ตำแหน่ง global ซึ่งหมายความว่าคำขอของคุณจะได้รับการจัดการโดยโมเดลที่พร้อมใช้งาน
ทุกที่ในพูลทั่วโลก การใช้ตำแหน่ง global สำหรับคำขอจะช่วยให้คุณหลีกเลี่ยงการเข้าถึงขีดจำกัดความจุของโมเดลและลดข้อผิดพลาด "บริการไม่พร้อมใช้งาน" (503) นอกจากนี้ การใช้ตำแหน่ง global อาจ จำเป็น ทั้งนี้ขึ้นอยู่กับโมเดล
กรณีที่ต้องตั้งค่าตำแหน่งอย่างชัดเจน
Firebase AI Logic มีค่าเริ่มต้นอัตโนมัติสำหรับตำแหน่ง (เช่น
global เมื่อใช้ไวยากรณ์การเริ่มต้น "Agent Platform") อย่างไรก็ตาม หาก
คุณต้องการใช้ตำแหน่งอื่น คุณจะต้อง
ระบุตำแหน่งอย่างชัดเจนในระหว่างการเริ่มต้นบริการแบ็กเอนด์
Agent Platform Gemini API (formerly Vertex AI)ในโค้ด
การตั้งค่าตำแหน่งอย่างชัดเจนอาจ จำเป็น ทั้งนี้ขึ้นอยู่กับโมเดล
หากคำขอพยายามเข้าถึงโมเดลในตำแหน่งที่โมเดลไม่พร้อมใช้งาน
คุณจะได้รับข้อผิดพลาด 404 ที่ระบุว่าโมเดล
was not found or your project does not have access to it
Gemini โมเดลเวอร์ชันทดลองและ เวอร์ชันเบต้า: พร้อมให้บริการ ในตำแหน่ง
globalเท่านั้น (ยกเว้น Live API - ดูด้านล่าง)Gemini 3.x โมเดล: พร้อมให้บริการ ในตำแหน่ง
globalเท่านั้นเมื่อใช้ Firebase AI Logic Firebase AI Logic ยังไม่ รองรับตำแหน่งusและeuGemini 2.5 โมเดล: พร้อมให้บริการในหลายตำแหน่ง.
Gemini Live API โมเดล: พร้อมให้บริการ ในตำแหน่ง
us-central1เท่านั้น ระบบ ไม่ รองรับตำแหน่งglobal
ดูรายการตำแหน่งทั้งหมดที่พร้อมให้บริการในส่วนท้ายของ หน้านี้
ข้อเท็จจริงและแนวทางปฏิบัติแนะนำทั่วไป
ข้อเท็จจริงและแนวทางปฏิบัติแนะนำที่สำคัญบางส่วนเกี่ยวกับตำแหน่งมีดังนี้
ขีดจำกัดความจุเป็นไปตามโมเดล ต่อภูมิภาค ต่อนาที
หากต้องการหลีกเลี่ยงการเข้าถึงขีดจำกัดความจุโดยไม่คาดคิด ให้ลองใช้ตำแหน่ง
global(หากโมเดลของคุณรองรับตำแหน่งglobal)ลองใช้ Firebase Remote Config เพื่อควบคุมตำแหน่งที่คุณเข้าถึงโมเดล วิธีนี้จะช่วยให้คุณเปลี่ยนตำแหน่งได้โดยไม่ต้องเผยแพร่แอปเวอร์ชันใหม่
หากการใช้ตำแหน่ง
globalไม่สามารถใช้ได้หรือระบบไม่รองรับกรณีการใช้งานของคุณ ให้ลองกระจายตำแหน่งที่คุณเข้าถึงโมเดลอย่างชัดเจน เช่น คุณสามารถตั้งค่าตำแหน่งตามตำแหน่งของผู้ใช้ปลายทางได้โดยใช้ Firebase Remote Config
ตัวอย่างโค้ด
Firebase AI Logic มีค่าเริ่มต้นอัตโนมัติสำหรับตำแหน่ง (เช่น
global เมื่อใช้ไวยากรณ์การเริ่มต้น "Agent Platform") อย่างไรก็ตาม หาก
คุณต้องการใช้ตำแหน่งอื่น คุณจะต้อง
ระบุตำแหน่งอย่างชัดเจนในระหว่างการเริ่มต้นบริการแบ็กเอนด์
Agent Platform Gemini API (formerly Vertex AI)ในโค้ด
แทนที่ LOCATION ด้วยรหัสตำแหน่ง (เช่น global หรือ
europe-west4) จากรายการตำแหน่งที่พร้อมให้บริการ
ในส่วนท้ายของหน้านี้
ไวยากรณ์ของ Agent Platform
Swift
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
let ai = FirebaseAI.firebaseAI(backend: .agentPlatform(location: "LOCATION"))
// ...
Kotlin
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
val ai = Firebase.ai(backend = GenerativeBackend.agentPlatform(location = "LOCATION"))
// ...
Java
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.agentPlatform("LOCATION"));
// ...
Web
// ...
// Initialize FirebaseApp
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `AgentPlatformBackend` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
const ai = getAI(firebaseApp, { backend: new AgentPlatformBackend('LOCATION') });
// ...
Dart
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `agentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
final ai = await FirebaseAI.agentPlatform(location: 'LOCATION');
// ...
Unity
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the `AgentPlatform` syntax, the default location is `global`, so
// specifying a location is usually optional since most models are supported in `global`.
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.AgentPlatform(location: "LOCATION"));
// ...
ไวยากรณ์ของ Vertex AI
Swift
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexai` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
let ai = FirebaseAI.firebaseAI(backend: .vertexai(location: "LOCATION"))
// ...
Kotlin
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
val ai = Firebase.ai(backend = GenerativeBackend.vertexAI(location = "LOCATION"))
// ...
Java
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI("LOCATION"));
// ...
Web
// ...
// Initialize FirebaseApp
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `VertexAIBackend` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
const ai = getAI(firebaseApp, { backend: new VertexAIBackend('LOCATION') });
// ...
Dart
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `vertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
final ai = await FirebaseAI.vertexAI(location: 'LOCATION');
// ...
Unity
// ...
// Initialize the Agent Platform Gemini API backend service (formerly branded Vertex AI).
// For the legacy `VertexAI` syntax, the default location is `us-central`, so
// specifying a location is usually required since most models are *not* supported in `us-central`.
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.VertexAI(location: "LOCATION"));
// ...
โปรดทราบว่าหากคุณระบุตำแหน่งที่โมเดลไม่พร้อมใช้งาน คุณจะได้รับ
ข้อผิดพลาด 404 ที่ระบุว่าไม่พบโมเดล
was not found or your project does not have access to it
ตำแหน่งที่พร้อมให้บริการ
Google Cloud ใช้ ภูมิภาค. Google Cloud จะจัดเก็บข้อมูลลูกค้าในภูมิภาคที่คุณระบุไว้สำหรับฟีเจอร์ Generative AI บน Agent Platform ที่พร้อมให้บริการโดยทั่วไปทั้งหมด
Generative AI บน Agent Platform พร้อมให้บริการในภูมิภาคต่อไปนี้ โมเดลและ/หรือเวอร์ชันบางรายการอาจไม่พร้อมให้บริการในบางตำแหน่ง (ดูความพร้อมให้บริการในแต่ละตำแหน่งโดยละเอียดได้ใน Google Cloudเอกสารประกอบ)
โปรดทราบดังต่อไปนี้
Firebase AI Logic จะใช้ตำแหน่ง
us-central1เป็นค่าเริ่มต้นสำหรับโมเดลGemini เวอร์ชันทดลองทั้งหมด (ยกเว้นโมเดลLive API) ตำแหน่งที่รองรับ เท่านั้น คือ
globalเมื่อใช้ Firebase AI Logic เพื่อเข้าถึงโมเดล Gemini 3.x ตำแหน่งที่รองรับ เท่านั้น คือ
globalFirebase AI Logic ยังไม่ รองรับตำแหน่งusและeuสำหรับโมเดล Live API ทั้งหมดและโมเดล Imagen ทั้งหมด ระบบ
globalไม่ รองรับตำแหน่ง
ทั่วโลก
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)