ระบุตำแหน่งที่จะเรียกใช้บริการและเข้าถึงโมเดล

เมื่อเริ่มต้นบริการ Vertex AI คุณสามารถระบุตำแหน่งที่จะเรียกใช้บริการและเข้าถึงโมเดลได้ (ไม่บังคับ) ค่าเริ่มต้นจะเป็น us-central1 หากไม่ได้ระบุตำแหน่ง ดูรายการสถานที่ที่พร้อมให้บริการในหน้านี้

ตัวอย่างโค้ด

โปรดทราบว่าตัวอย่างเหล่านี้แสดงการเข้าถึงโมเดล Gemini แต่คุณระบุตำแหน่งได้เมื่อเข้าถึงโมเดล Imagen 3

Swift

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")

Kotlin

// 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")

Java

// 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);

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
// 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' });

Dart

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 ใช้ regions เพื่อกําหนด API ระดับภูมิภาค Google Cloud จะจัดเก็บข้อมูลลูกค้าเฉพาะในภูมิภาคที่คุณระบุสำหรับฟีเจอร์ Generative AI ทั้งหมดที่พร้อมให้บริการแก่ผู้ใช้ทั่วไปใน Vertex AI

Generative AI ใน Vertex 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)