Nhấp vào nhà cung cấp Gemini API để xem nội dung và mã dành riêng cho nhà cung cấp trên trang này. |
Các mô hình AI tạo sinh của Google hiện có ở một số khu vực.
Khi khởi chạy dịch vụ phụ trợ Vertex AI Gemini API trong mã, bạn có thể không bắt buộc chỉ định vị trí cho mô hình mà bạn đang truy cập trong các yêu cầu. Nếu bạn không chỉ định vị trí, giá trị mặc định sẽ là us-central1
.
Xem danh sách các vị trí hiện có ở phần sau của trang này.
Firebase AI Logic chưa hỗ trợ vị trí chung cho Vertex AI.
Mã mẫu
Xin lưu ý rằng các mẫu này cho thấy việc truy cập vào mô hình Gemini, nhưng bạn cũng có thể chỉ định vị trí khi truy cập vào mô hình Imagen 3.
Thay thế LOCATION bằng mã vị trí (ví dụ: europe-west4
) trong danh sách các vị trí có sẵn ở phần sau của trang này.
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');
// ...
Unity
// ...
// 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");
// ...
Địa điểm cung cấp
Google Cloud sử dụng khu vực. Google Cloud chỉ lưu trữ dữ liệu khách hàng ở khu vực mà bạn chỉ định cho tất cả các tính năng phổ biến của AI tạo sinh trên Vertex AI.
AI tạo sinh trên Vertex AI được cung cấp ở những khu vực sau. Một số mẫu và/hoặc phiên bản cụ thể có thể không có ở một số vị trí (để biết thông tin chi tiết về phạm vi cung cấp theo vị trí, hãy xem tài liệu về Google Cloud).
Hoa Kỳ
- Columbus, Ohio (
us-east5
) - Dallas, Texas (
us-south1
) - Iowa (
us-central1
) - Las Vegas, Nevada (
us-west4
) - Moncks Corner, South Carolina (
us-east1
) - Bắc Virginia (
us-east4
) - Oregon (
us-west1
)
Canada
- Montréal (
northamerica-northeast1
)
Nam Mỹ
- Sao Paulo, Brazil (
southamerica-east1
)
Châu Âu
- Bỉ (
europe-west1
) - Phần Lan (
europe-north1
) - Frankfurt, Đức (
europe-west3
) - London, Vương quốc Anh (
europe-west2
) - Madrid, Tây Ban Nha (
europe-southwest1
) - Milan, Ý (
europe-west8
) - Hà Lan (
europe-west4
) - Paris, Pháp (
europe-west9
) - Warsaw, Ba Lan (
europe-central2
) - Zürich, Thuỵ Sĩ (
europe-west6
)
Châu Á Thái Bình Dương
- Huyện Chương Hóa, Đài Loan (
asia-east1
) - Hong Kong, Trung Quốc (
asia-east2
) - Mumbai, Ấn Độ (
asia-south1
) - Seoul, Hàn Quốc (
asia-northeast3
) - Singapore (
asia-southeast1
) - Sydney, Úc (
australia-southeast1
) - Tokyo, Nhật Bản (
asia-northeast1
)
Trung Đông
- Dammam, Ả Rập Xê Út (
me-central2
) - Doha, Qatar (
me-central1
) - Tel Aviv, Israel (
me-west1
)