googleapis / googleapis/python-aiplatform

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

Đang mở
#4,851 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: vertex-ai
Ngôn ngữ chính
Python
Star
905
Fork
465
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
44

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by tracing the prompt flow in vertexai/prompts/_prompt_management.py, especially _create_prompt_resource and _create_dataset, then inspect the DatasetService create_dataset request shown in the traceback. Determine how the SDK can pass a KMS CryptoKey when creating prompt resources. Done means prompt creation works under the stated restrictNonCmekServices policy, with coverage for the CMEK path and any needed documentation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
google-cloud, python
Lĩnh vực
cloud, machine-learning, security
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.