feat(prompts): expose create_time and add creator attribution to prom…#6415
Open
priyankaiitg wants to merge 1 commit intogoogleapis:mainfrom
Open
feat(prompts): expose create_time and add creator attribution to prom…#6415priyankaiitg wants to merge 1 commit intogoogleapis:mainfrom
priyankaiitg wants to merge 1 commit intogoogleapis:mainfrom
Conversation
…pt versions ## Changes Summary - Added `create_time` (datetime) and `creator` (str) fields to `PromptVersionMetadata` dataclass. - Added optional `creator` parameter to `create_version()` so callers can record who saved a prompt version (e.g. an email address). - Updated `list_versions()` to populate `create_time` from `DatasetVersion.create_time` (already returned by the API but previously discarded) and decode `creator` from the version display name. - Added `_encode_display_name` / `_decode_display_name` helpers and `_CREATOR_DELIMITER` constant to implement the encoding convention. - Threaded the `creator` argument through `_create_prompt_resource`, `_create_prompt_version_resource`, and `_create_dataset_version`. - Added `import datetime` to support timezone-aware datetime conversion. ## Limitation The Vertex AI `DatasetVersion` API has no native creator/user field in its proto. The `metadata` field is output-only (auto-populated by the backend), leaving `display_name` as the only user-writable field on a version. Creator identity is therefore encoded as a suffix in `display_name` using the delimiter `__creator__` and transparently decoded on read. Versions saved via the Vertex AI Console or older SDK versions will have `creator=None`. Only versions created through this SDK with an explicit `creator` argument will carry attribution. ## Recommendation File a feature request with the Vertex AI team to add a first-class `creator` / `last_modified_by` field to the `DatasetVersion` proto. That is the proper fix for full, reliable, historical user attribution across all clients (SDK, Console, API). Once available, the SDK encoding workaround here can be removed and the field populated directly.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…pt versions
Changes Summary
create_time(datetime) andcreator(str) fields toPromptVersionMetadatadataclass.creatorparameter tocreate_version()so callers can record who saved a prompt version (e.g. an email address).list_versions()to populatecreate_timefromDatasetVersion.create_time(already returned by the API but previously discarded) and decodecreatorfrom the version display name._encode_display_name/_decode_display_namehelpers and_CREATOR_DELIMITERconstant to implement the encoding convention.creatorargument through_create_prompt_resource,_create_prompt_version_resource, and_create_dataset_version.import datetimeto support timezone-aware datetime conversion.Limitation
The Vertex AI
DatasetVersionAPI has no native creator/user field in its proto. Themetadatafield is output-only (auto-populated by the backend), leavingdisplay_nameas the only user-writable field on a version. Creator identity is therefore encoded as a suffix indisplay_nameusing the delimiter__creator__and transparently decoded on read.Versions saved via the Vertex AI Console or older SDK versions will have
creator=None. Only versions created through this SDK with an explicitcreatorargument will carry attribution.Recommendation
File a feature request with the Vertex AI team to add a first-class
creator/last_modified_byfield to theDatasetVersionproto. That is the proper fix for full, reliable, historical user attribution across all clients (SDK, Console, API). Once available, the SDK encoding workaround here can be removed and the field populated directly.Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Note: do not merge your PR from GitHub. Adding the "ready to pull" label is the final step in the review process.
After approvals, the changes in your PR will be committed to the
mainbranch and this PR will be closed.Fixes #<issue_number_goes_here> 🦕