控管 Model Garden 模型的存取權

Model Garden 的組織政策可讓您集中控管使用者能存取的模型,以及可執行的動作。根據預設,凡是有權使用 Gemini Enterprise Agent Platform 的使用者,都能透過 Model Garden 探索、自訂及部署各種 Google 和第三方模型。

舉例來說,如果您有一組可在正式環境中使用的核准 Google 和第三方模型,設定 Model Garden 政策可能會有幫助。您可以在組織、資料夾或專案層級定義政策,讓使用者只能存取核准的模型。政策適用於所有主體。組織政策並非個別使用者政策。詳情請參閱「組織政策服務簡介」。

政策評估

評估時,系統會審查所有影響特定資源的政策,並只合併及評估適用的政策。任何明確拒絕值都優先於任何明確允許值。

舉例來說,假設資料夾政策拒絕特定模型,而專案政策允許該模型。假設政策已合併,由於資料夾層級的明確拒絕政策優先順序較高,因此專案層級的模型存取權會遭到拒絕。不過,如果將專案政策設為覆寫所有上層政策,則可在專案層級存取模型。

詳情請參閱 Resource Manager 說明文件中的「瞭解階層評估」。

注意事項

  • Model Garden 組織政策僅適用於 Model Garden 中的模型。舉例來說,這項政策不適用於在 Gemini Enterprise Agent Platform Model Registry 註冊的模型。
  • 組織政策的允許和拒絕值不得超過 500 個。
  • 如果是自訂政策,則必須個別指定每個模型。您無法允許或拒絕一組模型。例如,您無法拒絕所有第三方模型,或只允許 Google 模型執行預測動作。

政策詳細資料

設定政策時,您需要定義下列其中一項動作:

  • 允許所有模型。
  • 拒絕所有模型。
  • 設定自訂政策規則,允許或拒絕特定模型清單。

根據預設,如果未設定或繼承任何政策,系統會允許所有模型和動作。

如果是自訂拒絕政策,您會明確拒絕一系列模型,並隱含允許所有其他模型。同樣地,如果是自訂允許政策,您會明確允許一系列模型,並隱含拒絕所有其他模型。

如要在自訂政策和模型動作中指定模型,請使用下列格式:

publishers/PUBLISHER/models/MODEL_NAME:ACTION

更改下列內容:

  • PUBLISHER:政策適用的模型擁有者名稱。
  • MODEL_NAME:要允許或拒絕的模型名稱。
  • ACTION:要納入政策的模型動作。

舉例來說,如要針對 Gemini 3.5 Flash 模型的預測定義政策規則,請指定 publishers/google/models/gemini-3.5-flash:predict。

完整 ID (publishers/PUBLISHER/models/MODEL_NAME) 也稱為模型 ID。如要找出模型的 ID,請前往 Model Garden 中的模型資訊卡。如需模型資訊卡的連結,請參閱「探索 Model Garden 中的 AI 模型」的模型清單。

模型動作

您可以允許或拒絕各模型的下列動作:

  • predict:指定使用者是否能透過代管 API (模型即服務),對模型執行線上和批次預測。
  • deploy:針對沒有代管 API 的模型,指定使用者是否可以在 Google Cloud上部署模型。舉例來說,這項動作適用於 Google Cloud 控制台中的一鍵部署作業。
  • tune:指定使用者是否可以調整模型。

設定模型動作政策

您可以使用 Google Cloud 控制台或 Google Cloud CLI 設定 Model Garden 政策。限制名稱為 vertexai.allowedModels。如要進一步瞭解如何設定政策,請參閱 Resource Manager 說明文件中的下列主題:

合作夥伴模型功能

如果是合作夥伴模型,您可以允許或禁止下列動作:

  • web_search:指定使用者是否能透過網頁搜尋使用合作夥伴模型。對於屬於組織的專案,這項功能預設為拒絕,必須明確允許。
  • structured_outputs:指定使用者是否能對合作夥伴模型使用結構化輸出內容。如果專案屬於某個組織,這項功能預設為拒絕,必須明確允許。

設定合作夥伴模型功能的政策

您可以使用 vertexai.allowedPartnerModelFeatures 限制,允許或拒絕合作夥伴模型的 web_search 和 structured_outputs。

範例政策

下列範例政策採用 YAML 格式,您在透過 gcloud CLI 設定政策時會用到。

拒絕一組模型,並允許所有其他模型

以下範例會拒絕對一組特定模型執行動作。

name: organizations/ORGANIZATION_ID/policies/vertexai.allowedModels
spec:
  rules:
    values:
      deniedValues:
      - publishers/meta/models/llama3:deploy
      - publishers/google/models/gemini-3.5-flash:tune
      - publishers/hf-google/models/gemma-2b:deploy

將 ORGANIZATION_ID 替換為您的 Google Cloud組織 ID。詳情請參閱「取得組織資源」。

允許一組模型,並拒絕所有其他模型

以下範例允許對一組特定模型執行動作。

name: organizations/ORGANIZATION_ID/policies/vertexai.allowedModels
spec:
  rules:
    values:
      allowedValues:
      - publishers/meta/models/llama3:deploy
      - publishers/google/models/gemini-3.5-flash:tune
      - publishers/hf-google/models/gemma-2b:deploy

如要為合作夥伴模型啟用 web_search 功能,您可以指定下列項目:

  • 特定發布商所有模型的所有功能,例如: publishers/anthropic
  • 特定模型的所有特徵,例如: publishers/anthropic/models/MODEL_NAME
  • 特定模型的 web_search 功能,例如: publishers/anthropic/models/MODEL_NAME:web_search

以下範例會為 Anthropic 的所有模型啟用 web_search:

name: organizations/ORGANIZATION_ID/policies/vertexai.allowedPartnerModelFeatures
spec:
  rules:
    values:
      allowedValues:
      # Allow all features of this publisher
      - publishers/anthropic
      # Allow all features of this model
      - publishers/anthropic/models/MODEL_NAME
      # Allow this feature
      - publishers/anthropic/models/MODEL_NAME:web_search

為合作夥伴模型啟用 structured_outputs

如要為合作夥伴模型啟用 structured_outputs 功能,您可以指定下列項目:

  • 特定發布商所有模型的所有功能,例如: publishers/anthropic
  • 特定模型的所有特徵,例如: publishers/anthropic/models/MODEL_NAME
  • 特定模型的 structured_outputs 功能,例如: publishers/anthropic/models/MODEL_NAME:structured_outputs

以下範例會為 Anthropic 的所有模型啟用 structured_outputs:

name: organizations/ORGANIZATION_ID/policies/vertexai.allowedPartnerModelFeatures
spec:
  rules:
    values:
      allowedValues:
      # Allow all features of this publisher
      - publishers/anthropic
      # Allow all features of this model
      - publishers/anthropic/models/MODEL_NAME
      # Allow this feature
      - publishers/anthropic/models/MODEL_NAME:structured_outputs

後續步驟

指南

在 使用 Model Garden 的生成式模型。

指南

在 Model Garden 中使用試用版,快速查看及測試各種模型的功能。