Skip to content

feat(prompts): expose create_time and add creator attribution to prom…#6415

Open
priyankaiitg wants to merge 1 commit intogoogleapis:mainfrom
priyankaiitg:prompt-username
Open

feat(prompts): expose create_time and add creator attribution to prom…#6415
priyankaiitg wants to merge 1 commit intogoogleapis:mainfrom
priyankaiitg:prompt-username

Conversation

@priyankaiitg
Copy link

…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.

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Get the necessary approvals
  • Once the last commit on the PR has been approved, add the "ready to pull" label to the Pull Request

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 main branch and this PR will be closed.

Fixes #<issue_number_goes_here> 🦕

…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.
@priyankaiitg priyankaiitg requested a review from a team as a code owner March 12, 2026 06:27
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Mar 12, 2026
@google-cla
Copy link

google-cla bot commented Mar 12, 2026

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.

@priyankaiitg
Copy link
Author

#6414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant