如果您是第一次使用 Gemini,可透過快速入門導覽課程 是最快的起點
不過,由於生成式 AI 解決方案已成熟,因此您可能需要建構和導入 以及端對端的部署方式Google Cloud 提供 提供完善的工俱生態系統,讓開發人員運用生成式 AI 的強大威力。 從應用程式開發的初始階段,到應用程式部署、應用程式託管和複雜管理 大規模部署資料
Google Cloud 的 Vertex AI 平台提供一套機器學習運作工具,能簡化使用、部署和部署工作 以及監控 AI 模型來提升效率和可靠性此外,整合 資料庫、開發運作工具、記錄、監控及 IAM 提供全方位的做法,讓您輕鬆管理 整個生成式 AI 生命週期的威脅
下表摘要列出 Google AI 和 Vertex AI 的主要差異,協助您 根據您的用途決定適合的選項:
功能 | Google AI Gemini API | Vertex AI Gemini API |
---|---|---|
Gemini 模型 | Gemini 1.5 Flash、Gemini 1.5 Pro、Gemini 1.0 Pro、Gemini 1.0 Pro Vision (已淘汰) | Gemini 1.5 Flash、Gemini 1.5 Pro、Gemini 1.0 Pro、Gemini 1.0 Pro Vision、Gemini 1.0 Ultra Gemini 1.0 Ultra Vision |
申請 | Google 帳戶 | Google Cloud 帳戶 (須簽署條款協議與帳單) |
驗證 | API 金鑰 | Google Cloud 服務帳戶 |
使用者介面遊樂場 | Google AI Studio | Vertex AI Studio |
API 與SDK | 伺服器和行動/網路用戶端 SDK
|
伺服器和行動/網路用戶端 SDK
|
免費使用 API 和SDK | 是, 如適用 | 新使用者可獲得價值 $300 美元的 Google Cloud 抵免額 |
配額 (每分鐘的要求數量) | 依型號和定價方案而異 (請參閱詳細資訊)。 | 因型號和區域而異 (請參閱詳細資訊)。 |
企業支援 | 否 |
客戶加密金鑰 虛擬私有雲 資料落地 資料存取透明化控管機制 用於託管應用程式的可擴充基礎架構 資料庫和資料儲存空間 |
機器學習運作 | 否 | Vertex AI 的完整機器學習運作 (例如模型評估、模型監控、Model Registry) |
瞭解哪些產品、架構和工具最適合用於建構 您的生成式 AI 應用程式 在 Google Cloud 建構生成式 AI 應用程式。
從 Google AI 專用 Gemini 遷移至 Vertex AI
如果應用程式使用 Google AI Gemini API,請遷移至 Google Cloud 的 Vertex AI Gemini API
遷移注意事項:
您可以使用現有的 Google Cloud 專案 (您用來產生 API 金鑰的同一個金鑰) 也可以 建立新的 Google Cloud 專案。
Google AI Studio 和 Vertex AI 的支援區域可能不同。詳情請參閱 Google Cloud 生成式 AI 支援區域的清單。
在 Google AI Studio 中建立的所有模型,都必須使用 Vertex AI 重新訓練。
Python:從 Google AI Gemini API 遷移至 Vertex AI Gemini API
下列各節顯示程式碼片段可協助您遷移 Python 程式碼,以便使用 開始探索 Gemini API
Vertex AI Python SDK 設定
在 Vertex AI 中,您不需要提供 API 金鑰。Vertex AI 的 Gemini 是透過 IAM 存取權管理 控管使用者、群組或服務帳戶呼叫 Gemini API 的權限 Vertex AI SDK
雖然 進行驗證,在開發環境中驗證最簡單的方法就是 安裝 Google Cloud CLI 然後使用您的使用者憑證 登入 CLI。
如要對 Vertex AI 進行推論呼叫,您必須確認使用者或服務帳戶已 Vertex AI 使用者角色:
程式碼範例:安裝用戶端
Google AI | Vertex AI |
---|---|
|
|
透過文字提示生成文字的程式碼範例
Google AI | Vertex AI |
---|---|
|
|
從文字和圖片生成文字的程式碼範例
Google AI | Vertex AI |
---|---|
|
|
生成多輪聊天的程式碼範例
Google AI | Vertex AI |
---|---|
|
|
刪除未使用的 API 金鑰
如果不再需要 Google AI Gemini API 金鑰,請依循安全性最佳做法 並加以刪除
刪除 API 金鑰的做法如下:
開啟 Google Cloud API 憑證 頁面。
找出要刪除的 API 金鑰,然後按一下「動作」圖示。
選取「刪除 API 金鑰」。
在「刪除憑證」互動視窗中,選取「刪除」。
刪除 API 金鑰需要幾分鐘的時間才會生效。作業完畢後,凡是使用已刪除 API 金鑰的流量都會遭拒。
後續步驟
- 詳情請參閱 Vertex AI 的生成式 AI 總覽 ,進一步瞭解 Vertex AI 的生成式 AI 解決方案。
- 進一步瞭解 Vertex AI Gemini API。