Modele generatywnej AI od Google są udostępniane za pomocą określonych punktów końcowych regionalnych.
Podczas inicjowania usługi Vertex AI możesz opcjonalnie określić lokalizację punktu końcowego modelu, do którego uzyskujesz dostęp w żądaniach. Jeśli nie określisz lokalizacji, zostanie użyta wartość domyślna us-central1
. Listę dostępnych lokalizacji znajdziesz niżej na tej stronie.
Usługa Vertex AI in Firebase jeszcze nie obsługuje globalnego punktu końcowego w Vertex AI.
Przykładowe fragmenty kodu
Pamiętaj, że te przykłady pokazują dostęp do modelu Gemini, ale możesz też określić lokalizację podczas uzyskiwania dostępu do modelu Imagen 3.
Zastąp LOCATION kodem lokalizacji (np. europe-west4
) z listy dostępnych lokalizacji, która znajduje się dalej na tej stronie.
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');
Dostępne lokalizacje
Google Cloud używa regionów do definiowania regionalnych punktów końcowych. Google Cloud przechowuje dane klientów tylko w regionie, który określisz dla wszystkich ogólnie dostępnych funkcji generatywnej AI w Vertex AI.
Generatywna AI w Vertex AI jest dostępna w tych regionach. Niektóre modele lub wersje mogą nie być dostępne we wszystkich lokalizacjach (szczegółowe informacje o dostępności w danej lokalizacji znajdziesz w Google Clouddokumentacji).
Stany Zjednoczone
- Columbus, Ohio (
us-east5
) - Dallas, Teksas (
us-south1
) - Iowa (
us-central1
) - Las Vegas, Nevada (
us-west4
) - Moncks Corner, Karolina Południowa (
us-east1
) - Północna Wirginia (
us-east4
) - Oregon (
us-west1
)
Kanada
- Montréal (
northamerica-northeast1
)
Ameryka Południowa
- São Paulo, Brazylia (
southamerica-east1
)
Europa
- Belgia (
europe-west1
) - Finlandia (
europe-north1
) - Frankfurt, Niemcy (
europe-west3
) - Londyn, Wielka Brytania (
europe-west2
) - Madryt, Hiszpania (
europe-southwest1
) - Mediolan, Włochy (
europe-west8
) - Holandia (
europe-west4
) - Paryż, Francja (
europe-west9
) - Warszawa, Polska (
europe-central2
) - Zurych, Szwajcaria (
europe-west6
)
Azja i Pacyfik
- Powiat Zhanghua, Tajwan (
asia-east1
) - Hongkong, Chiny (
asia-east2
) - Mumbaj, Indie (
asia-south1
) - Seul, Korea (
asia-northeast3
) - Singapur (
asia-southeast1
) - Sydney, Australia (
australia-southeast1
) - Tokio, Japonia (
asia-northeast1
)
Bliski Wschód
- Dammam, Arabia Saudyjska (
me-central2
) - Doha, Katar (
me-central1
) - Tel Awiw, Izrael (
me-west1
)