如需启用开放模型并发出提示请求, Google Cloud管理员必须设置所需的权限,并验证组织政策是否允许使用所需的 API。
设置使用开放模型所需的权限
如需使用开放模型,您需要拥有以下角色和权限:
您必须具有 Consumer Procurement Entitlement Manager Identity and Access Management (IAM) 角色。任何被授予此角色的用户都可以在 Model Garden 中启用开放模型。
您必须拥有
aiplatform.endpoints.predict
权限。此权限包含在 Vertex AI User IAM 角色中。如需了解详情,请参阅 Vertex AI User 和访问权限控制。
控制台
gcloud
-
In the Google Cloud console, activate Cloud Shell.
授予在 Model Garden 中启用开放模型所需的 Consumer Procurement Entitlement Manager 角色
gcloud projects add-iam-policy-binding PROJECT_ID \ --member=PRINCIPAL --role=roles/consumerprocurement.entitlementManager
授予包含发出提示请求所需的
aiplatform.endpoints.predict
权限的 Vertex AI User 角色:gcloud projects add-iam-policy-binding PROJECT_ID \ --member=PRINCIPAL --role=roles/aiplatform.user
将
PRINCIPAL
替换为主账号的标识符。标识符的格式为user|group|serviceAccount:email
或domain:domain
,例如user:cloudysanfrancisco@gmail.com
、group:admins@example.com
、serviceAccount:test123@example.domain.com
或domain:example.domain.com
。输出是一个政策绑定列表,其中包含以下内容:
- members: - user:PRINCIPAL role: roles/roles/consumerprocurement.entitlementManager
如需了解详情,请参阅授予单个角色和
gcloud projects add-iam-policy-binding
。
设置开放模型访问权限的组织政策
如需启用开放模型,您的组织政策必须允许以下 API:Cloud Commerce Consumer Procurement API - cloudcommerceconsumerprocurement.googleapis.com
如果您的组织将组织政策设置为限制服务的使用,则组织管理员必须通过设置组织政策来验证是否允许 cloudcommerceconsumerprocurement.googleapis.com
。
此外,如果您的组织政策限制了 Model Garden 中的模型使用,则该政策必须允许访问开放模型。如需了解详情,请参阅控制模型访问权限。
后续步骤
- 了解如何针对开放模型调用 MaaS API。