feat: support file_data URI references in GcsArtifactService#5322
feat: support file_data URI references in GcsArtifactService#5322blueeye-040 wants to merge 3 commits intogoogle:mainfrom
Conversation
|
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. |
|
Response from ADK Triaging Agent Hello @blueeye-040, thank you for your contribution! Before we can review your pull request, you'll need to sign the Contributor License Agreement (CLA). You can do this at https://cla.developers.google.com/. Once you've signed the CLA, the status of the check will be updated. Thanks! |
|
I have read the CLA Document and I hereby sign the CLA |
68d876d to
fb49ae6
Compare
a8ebfdb to
6e13ad2
Compare
|
All CI checks should now be passing. This fixes the file_data URI support gap between GcsArtifactService and InMemoryArtifactService, closes #5230. Happy to make any changes the team needs. |
fdb809e to
f004631
Compare
GcsArtifactServicepreviously raisedNotImplementedErrorwhen saving atypes.Partwithfile_data. This PR adds fullfile_dataURI support to match the existingInMemoryArtifactServicebehavior.Link to Issue or Description of Change
Problem:
GcsArtifactService._save_artifactraisedNotImplementedErrorforfile_dataparts, whileInMemoryArtifactServicealready handled them. This madeGcsArtifactServiceunusable for any workflow that passes file URI references (e.g.gs://orartifact://URIs) as artifacts.Solution:
Store
file_dataURI references as zero-byte GCS blobs with afile_uricustom metadata key — no content to upload, just the URI pointer. On load, check for that metadata key before downloading bytes and restore the originaltypes.Part(file_data=...). Also switched_load_artifactto usebucket.get_blob()(which populates metadata) instead ofbucket.blob()(which does not).artifact://URIs are validated viaartifact_util.parse_artifact_uribefore saving.Testing Plan
Unit Tests:
Added 4 new tests in
tests/unittests/artifacts/test_artifact_service.py:test_gcs_save_artifact_with_external_gcs_uri— roundtrip save/load with ags://URItest_gcs_save_artifact_with_artifact_ref_uri— roundtrip save/load with anartifact://URItest_gcs_save_artifact_file_data_without_mime_type—file_datawith no mime_typetest_gcs_save_artifact_file_data_missing_uri_raises— emptyfile_uriraisesInputValidationError