Speicherort für den Zugriff auf das Modell angeben

Klicke auf deinen Gemini API-Anbieter, um dir anbieterspezifische Inhalte und Code auf dieser Seite anzusehen.


Die generativen KI-Modelle von Google sind in bestimmten Regionen verfügbar.

Wenn Sie den Vertex AI Gemini API-Backenddienst in Ihrem Code initialisieren, können Sie optional den Speicherort für das Modell angeben, auf das Sie in Ihren Anfragen zugreifen. Wenn Sie keinen Standort angeben, ist us-central1 der Standardwert. Eine Liste der verfügbaren Standorte finden Sie weiter unten auf dieser Seite.

Firebase AI Logic unterstützt noch nicht den globalen Standort für Vertex AI.

Codebeispiele

In diesen Beispielen wird der Zugriff auf ein Gemini-Modell gezeigt. Sie können den Speicherort aber auch beim Zugriff auf ein Imagen 3-Modell angeben.

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: '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");

// ...

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 Generative AI 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. Detaillierte Informationen zur Verfügbarkeit an Ihrem Standort finden Sie in der Google CloudDokumentation.

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)