Los modelos de IA generativa de Google se exponen a través de extremos regionales específicos.
Cuando inicializas el servicio de Vertex AI, puedes de forma opcional especificar la ubicación del extremo del modelo al que accedes en tus solicitudes. Si no especificas una ubicación, el valor predeterminado es us-central1
. Consulta la lista de ubicaciones disponibles más adelante en esta página.
Vertex AI in Firebase aún no admite el extremo global para Vertex AI.
Muestras de código
Ten en cuenta que estos ejemplos muestran el acceso a un modelo Gemini, pero también puedes especificar la ubicación cuando accedes a un modelo Imagen 3.
Reemplaza LOCATION por el código de ubicación (por ejemplo, europe-west4
) de la lista de ubicaciones disponibles que aparece más adelante en esta página.
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');
Ubicaciones disponibles
Google Cloud usa regiones para definir extremos regionales. Google Cloud solo almacena los datos del cliente en la región que especifiques para todas las funciones de disponibilidad general de la IA generativa en Vertex AI.
La IA generativa en Vertex AI está disponible en las siguientes regiones: Es posible que algunos modelos o versiones específicas no estén disponibles en todas las ubicaciones (para obtener información detallada sobre la disponibilidad de las ubicaciones, consulta la documentación de Google Cloud).
Estados Unidos
- Columbus, Ohio (
us-east5
) - Dallas, Texas (
us-south1
) - Iowa (
us-central1
) - Las Vegas, Nevada - (
us-west4
) - Moncks Corner, Carolina del Sur (
us-east1
) - Virginia del Norte (
us-east4
) - Oregón (
us-west1
)
Canadá
- Montreal (
northamerica-northeast1
)
Sudamérica
- São Paulo, Brasil (
southamerica-east1
)
Europa
- Bélgica (
europe-west1
) - Finlandia (
europe-north1
) - Fráncfort, Alemania (
europe-west3
) - Londres, Reino Unido (
europe-west2
) - Madrid, España (
europe-southwest1
) - Milán, Italia (
europe-west8
) - Países Bajos (
europe-west4
) - París, Francia (
europe-west9
) - Varsovia, Polonia (
europe-central2
) - Zúrich, Suiza (
europe-west6
)
Asia-Pacífico
- Condado de Changhua, Taiwán (
asia-east1
) - Hong Kong, China (
asia-east2
) - Bombay, India (
asia-south1
) - Seúl, Corea (
asia-northeast3
) - Singapur (
asia-southeast1
) - Sídney, Australia (
australia-southeast1
) - Tokio, Japón (
asia-northeast1
)
Oriente Medio
- Dammam, Arabia Saudita (
me-central2
) - Doha, Catar (
me-central1
) - Tel Aviv, Israel (
me-west1
)