View a markdown version of this page

Gemma 4 E2B - Amazon Bedrock

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Gemma 4 E2B

Google logo with multicolored G letter icon. Google — Gemma 4 E2B

模型詳細資訊

Gemma 4 E2B 是 Google 的精簡模型,具有 51 億個總參數和 23 億個有效參數,使用每一層內嵌 (PLE),專為具有內建推理、原生函數呼叫和跨文字和映像的多模式輸入之低延遲工作負載而設計,支援 128K 字符內容視窗。如需模型開發和效能的詳細資訊,請參閱模型/服務卡

  • 模型啟動日期:2025 年 6 月 10 日

  • 模型 EOL 日期:不適用

  • 最終使用者授權合約和使用條款:檢視

  • 模型生命週期:作用中

  • 內容視窗:128K 權杖

輸入模式 輸出模式 支援的 APIs 支援的端點
Green circle with white checkmark icon. 音訊Red circle with white X icon indicating error, cancel, or close action. 內嵌Green circle with white checkmark icon. ResponsesRed circle with white X icon indicating error, cancel, or close action. bedrock-runtime
Green circle with white checkmark icon. 影像Red circle with white X icon indicating error, cancel, or close action. 影像Green circle with white checkmark icon. Chat CompletionsGreen circle with white checkmark icon. bedrock-mantle
Red circle with white X icon indicating error, cancel, or close action. 語音Red circle with white X icon indicating error, cancel, or close action. 語音Red circle with white X icon indicating error, cancel, or close action. Invoke
Green circle with white checkmark icon. 文字Green circle with white checkmark icon. 文字Red circle with white X icon indicating error, cancel, or close action. Converse
Green circle with white checkmark icon. 影片Red circle with white X icon indicating error, cancel, or close action. 影片Red circle with white X icon indicating error, cancel, or close action. Messages
注意

Gemma 4 模型僅適用於bedrock-mantle端點。

在 上bedrock-mantle,此模型會在 提供/openai/v1/responses,而不是預設的 /v1/responses

功能和功能

Bedrock 功能

使用bedrock-mantle端點支援的功能

支援的 不支援

定價

如需定價資訊,請參閱 Amazon Bedrock 定價頁面。

程式設計存取

使用以下模型 IDs和端點 URLs以程式設計方式存取此模型。如需可用 APIs和端點的詳細資訊,請參閱支援的 APIs支援的端點

端點 模型 ID 區域端點 URL 地理推論 ID 全域推論 ID
bedrock-mantle google.gemma-4-e2b https://bedrock-mantle.{region}.api.aws/openai/v1 不支援 不支援

例如,如果區域是 us-east-1 (維吉尼亞北部),則 bedrock-mantle 端點 URL 將為 "https://bedrock-mantle.us-east-1.api.aws/openai/v1"。

服務層

Amazon Bedrock 提供多種服務層,以符合您的工作負載需求。Standard 提供pay-per-token存取 (設定"service_tier": "default"或省略 欄位)。Priority 提供價格溢價最快的回應時間 (設定 "service_tier": "priority")。Flex 為彈性、non-time-sensitive的工作負載提供較低成本的存取 (設定 "service_tier": "flex")。預留會提供專用輸送量與可預測工作負載的期限承諾;它會在帳戶層級設定,而不是根據請求設定 (請聯絡您的 AWS 帳戶團隊啟用)。如需詳細資訊,請參閱 服務方案

標準 優先順序 Flex 預留
Green circle with white checkmark icon. Green circle with white checkmark icon. Green circle with white checkmark icon. Red circle with white X icon indicating error, cancel, or close action.

區域可用性

區域可用性一目了然

Amazon Bedrock 提供三種推論選項:嚴格合規,區域內將請求保留在單一區域內、在遵守資料駐留時跨區域 (例如美國、歐洲和亞太區域) 的地理跨區域路由,以及在沒有駐留限制的情況下在全球任何地方進行全球跨區域路由。如需詳細資訊,請參閱 依模型的區域可用性頁面。

區域 區域內 地理 全域
us-east-1 (維吉尼亞北部)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
us-east-2 (俄亥俄)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
us-west-2 (奧勒岡)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
eu-central-1 (法蘭克福)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.

配額和限制

AWS 您的帳戶具有預設配額來維持服務的效能,並確保適當使用 Amazon Bedrock。指派給帳戶的預設配額可能會根據區域因素、付款歷史記錄、詐騙使用量和/或配額增加請求的核准而更新。如需詳細資訊,請參閱 Amazon Bedrock 的配額 文件並參閱模型的限制

bedrock-mantle端點上消耗隨需輸送量時,可用的輸送量會隨著時間而擴展。並非所有配額內的請求都保證在高需求期間成功,因此逐步漸進很重要。對於此模型,預設限制不會直接透過 Service Quotas 顯示,因此我們建議您遵循漸進測試作為指南。

範例程式碼

步驟 1 - AWS 帳戶:如果您已經有 AWS 帳戶,請略過此步驟。如果您是新手 AWS,請註冊 AWS 帳戶

步驟 2 - API 金鑰:前往 Amazon Bedrock 主控台並產生長期 API 金鑰。

步驟 3 - 取得 SDK:若要使用此入門指南,您必須已安裝 Python。然後,根據您使用的 APIs相關軟體。

pip install openai

步驟 4 - 設定環境變數:設定您的環境以使用 API 金鑰進行身分驗證。

OPENAI_API_KEY="<provide your Bedrock API key>" OPENAI_BASE_URL="https://bedrock-mantle.<your-region>.api.aws/openai/v1"

步驟 5 - 執行您的第一個推論請求:將檔案儲存為 bedrock-first-request.py

Chat Completions API
from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="google.gemma-4-e2b", messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}] ) print(response)
Responses API
from openai import OpenAI client = OpenAI() response = client.responses.create( model="google.gemma-4-e2b", input="Explain the benefits of mixture-of-experts architectures for production inference.", max_output_tokens=512, ) print(response.output_text)

用量考量和限制

  • 推理模式 — 在聊天完成和回應 APIs 上都遵守推理工作,而且模型在這兩種情況下都會執行延長推理。不過,推理內容只會由 Responses API 傳回。聊天完成 API 不會傳回推理權杖,因為 OpenAI 聊天完成規格不支援傳回權杖。

  • 合理努力 — 對於 Gemma 4 E2B,我們建議reasoning_effort將 設定為 high,以啟用思維模式。此變體在預設情況下傾向於廣泛推理,而高推理工作會將該推理保存在專用推理管道中,這可改善輸出品質,並防止推理文字出現在最終回應中。

  • 平行工具呼叫 — 目前不支援一次請求多個工具呼叫。請求工具一次呼叫一個 。

  • 請求承載大小 — Gemma 4 E2B 的總請求內文承載,包括映像和影片,支援大小上限為 3.5 MB。