|
Klicken Sie auf Ihren Gemini API-Anbieter, um anbieterspezifische Inhalte und Code auf dieser Seite aufzurufen. |
Die generativen KI-Modelle von Google sind in bestimmten Regionen verfügbar.
Wenn Sie den Vertex AI Gemini API-Backend-Dienst in Ihrem Code initialisieren, können Sie optional den Speicherort für das Modell angeben, auf das Sie in Ihren Anfragen zugreifen. Eine Liste der verfügbaren Standorte finden Sie weiter unten auf dieser Seite.
Hier sind einige wichtige Fakten und Best Practices zu Standorten:
Kapazitätslimits gelten pro Modell, pro Region und pro Minute.
Wenn Sie keinen Standort angeben, ist der Standardwert
us-central1.Um unerwartete Kapazitätsüberschreitungen zu vermeiden, sollten Sie den Standort auf
globalfestlegen, sofern Ihr Modell den Standortglobalunterstützt.Wenn die Einstellung des Standorts auf
globalfür Ihren Anwendungsfall nicht zutrifft oder nicht unterstützt wird, sollten Sie explizit angeben, wo Sie auf Modelle zugreifen. Sie können den Standort beispielsweise anhand des Standorts des Endnutzers mit Firebase Remote Config festlegen.
Informationen zum Standort global
Für den Zugriff auf fast alle Gemini-Modelle unterstützt die Vertex AI Gemini API den Standort global. Das bedeutet, dass Ihre Anfrage von einem verfügbaren Modell aus dem globalen Pool bearbeitet wird.
Wenn Sie den Standort für Ihre Anfragen auf global festlegen, können Sie vermeiden, dass die Kapazitätsgrenzen für das Modell erreicht werden, und die Anzahl der Fehler vom Typ „Resource Exhausted“ (429) verringern.
Codebeispiele
In diesen Beispielen wird auf ein Gemini-Modell zugegriffen. Sie können aber auch einen Standort angeben, wenn Sie auf ein Imagen-Modell zugreifen.
Ersetzen Sie LOCATION durch den Standortcode (z. B. europe-west4) aus der Liste der verfügbaren Standorte weiter unten auf dieser Seite.
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');
// ...
Einheit
// ...
// 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");
// ...
Wenn Sie einen Standort angeben, an dem das Modell nicht verfügbar ist, erhalten Sie einen 404-Fehler mit der Meldung, dass das Modell was not found or your project does not have access to it.
Verfügbare Standorte
Google Cloud verwendet Regionen. Google Cloud speichert Kundendaten nur in der Region, die Sie für alle allgemein verfügbaren Funktionen von generativer KI in Vertex AI angeben.
Generative AI in Vertex AI ist in den folgenden Regionen verfügbar. Einige Modelle und/oder bestimmte Versionen sind möglicherweise nicht an allen Standorten verfügbar. (Die genaue Verfügbarkeit an Standorten finden Sie in der Google Cloud-Dokumentation.)
Alle Gemini-Modelle (außer Gemini Live-Modelle) sind auch am Standort global verfügbar. Für Imagen-Modelle wird der global-Standort nicht unterstützt.
USA
- Columbus, Ohio (
us-east5) - Dallas, Texas (
us-south1) - Iowa (
us-central1) - Las Vegas, Nevada (
us-west4) - Moncks Corner, South Carolina (
us-east1) - Virginia (
us-east4) - Oregon (
us-west1)
Kanada
- Montreal (
northamerica-northeast1)
Südamerika
- Sao Paulo, Brasilien (
southamerica-east1)
Europa
- Belgien (
europe-west1) - Finnland (
europe-north1) - Frankfurt, Deutschland (
europe-west3) - London, Vereinigtes Königreich (
europe-west2) - Madrid, Spanien (
europe-southwest1) - Mailand, Italien (
europe-west8) - Niederlande (
europe-west4) - Paris, Frankreich (
europe-west9) - Warschau, Polen (
europe-central2) - Zürich, Schweiz (
europe-west6)
Asiatisch-pazifischer Raum
- Bezirk Changhua, Taiwan (
asia-east1) - Hongkong, China (
asia-east2) - Mumbai, Indien (
asia-south1) - Seoul, Korea (
asia-northeast3) - Singapur (
asia-southeast1) - Sydney, Australien (
australia-southeast1) - Tokio, Japan (
asia-northeast1)
Naher Osten
- Dammam, Saudi-Arabien (
me-central2) - Doha, Katar (
me-central1) - Tel Aviv, Israel (
me-west1)