googleapis / googleapis/python-aiplatform

[Feature] CMEK support for Prompt Management with Vertex AI Python SDK

未关闭
#4,851 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: vertex-ai
主要语言
Python
星标
905
派生
465
平均合并
1 天 13 小时
30 天内合并 PR
44

描述

It is not (yet) documented [documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/ai-powered-prompt-writing ) but from my test CMEK is not yet supported when using Prompt management with Vertex AI Python SDK. When using the UI, you can save prompt using CMEK.

Here what I saw when using 1.74.0 (don't see anything in the release note of the newer version)

Anyway this doesn't seems to work in my code [3] base on [2]:
```
Traceback (most recent call last):

File "/home/jupyter/proj_ml_at_scale_gcp_exp/src/gen-ai/vertex-ai-prompt-manangement.py", line 51, in

prompt1 = prompts.create_version(prompt=prompt)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/jupyter/.conda-env/env_vertex_ai_llm/lib/python3.11/site-packages/vertexai/prompts/_prompt_management.py", line 298, in create_version

return _create_prompt_resource(prompt=prompt, version_name=version_name)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/jupyter/.conda-env/env_vertex_ai_llm/lib/python3.11/site-packages/vertexai/prompts/_prompt_management.py", line 445, in _create_prompt_resource

dataset = _create_dataset(prompt=prompt, parent=parent)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/jupyter/.conda-env/env_vertex_ai_llm/lib/python3.11/site-packages/vertexai/prompts/_prompt_management.py", line 393, in _create_dataset

operation = prompt._dataset_client.create_dataset(

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/jupyter/.conda-env/env_vertex_ai_llm/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/client.py", line 943, in create_dataset

response = rpc(

^^^^

File "/home/jupyter/.conda-env/env_vertex_ai_llm/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__

return wrapped_func(*args, **kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/jupyter/.conda-env/env_vertex_ai_llm/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 78, in error_remapped_callable

raise exceptions.from_grpc_error(exc) from exc

google.api_core.exceptions.FailedPrecondition: 400 The request has violated one or more Org Policies: violations {

type: "constraints/gcp.restrictNonCmekServices"

subject: "orgpolicy:projects/PROJECT"

description: "Constraint `constraints/gcp.restrictNonCmekServices` violated for `projects/PROJECT` attempting to create a resource without specifying a KMS CryptoKey."

}
```

FR: add CMEK support for Prompt Management with Vertex AI python SDK (already supported when using the UI to save prompts). I know that this come later as the feature is still in preview but just to mention our interest as all regulated industry need such capability.

贡献指南

打开贡献指南

调研方向

首先跟踪 vertexai/prompts/_prompt_management.py 中的 prompt 流程,尤其是 _create_prompt_resource 和 _create_dataset,然后检查 traceback 中显示的 DatasetService create_dataset 请求。确定 SDK 在创建 prompt 资源时如何传递 KMS CryptoKey。在所述 restrictNonCmekServices policy 下 prompt 创建能够正常工作,并覆盖 CMEK 路径及任何所需文档,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
google-cloud, python
领域
cloud, machine-learning, security
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。