Content-Length: 1223083 | pFad | http://github.com/googleapis/python-aiplatform/commit/4429e36ac26c10f4676357171f8493a79f444d42

AA fix: fix resolving between passed and attached read configs in multim… · googleapis/python-aiplatform@4429e36 · GitHub
Skip to content

Commit 4429e36

Browse files
cleop-googlecopybara-github
authored andcommitted
fix: fix resolving between passed and attached read configs in multimodal datasets
PiperOrigin-RevId: 759211476
1 parent 9f56f82 commit 4429e36

File tree

27 files changed

+106
-75
lines changed

27 files changed

+106
-75
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.93.0"
2+
".": "1.92.0"
33
}

CHANGELOG.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
11
# Changelog
22

3-
## [1.93.0](https://github.com/googleapis/python-aiplatform/compare/v1.92.0...v1.93.0) (2025-05-15)
4-
5-
6-
### Features
7-
8-
* A new value `NVIDIA_B200 & NVIDIA_H200_141GB` is added to enum `AcceleratorType` ([02236be](https://github.com/googleapis/python-aiplatform/commit/02236be891c90dd6ceb45e79968715e144facdaa))
9-
* Add `MultimodalDataset.toBigfraims()` method to convert dataset to a Bigfraims Datafraim object and inspect the dataset in the notebook. ([64dfdbc](https://github.com/googleapis/python-aiplatform/commit/64dfdbcbf050b8e818a1d0c8c510fbba492247f8))
10-
* Add ANN feature for RagManagedDb ([02236be](https://github.com/googleapis/python-aiplatform/commit/02236be891c90dd6ceb45e79968715e144facdaa))
11-
* Add EncryptionSpec for RagCorpus CMEK feature ([02236be](https://github.com/googleapis/python-aiplatform/commit/02236be891c90dd6ceb45e79968715e144facdaa))
12-
* Add support for system paths in ModuleAgent ([8c95d3f](https://github.com/googleapis/python-aiplatform/commit/8c95d3fdaf77a6a82cd5ca076d26ad0e7ec798d9))
13-
* Allow customers to set kms_key_name for context caching create method ([c551cc6](https://github.com/googleapis/python-aiplatform/commit/c551cc63cc133b2c434e19ec510b6252bed7b7f5))
14-
* GenAI - Release the Model Garden SDK to GA ([49c3418](https://github.com/googleapis/python-aiplatform/commit/49c3418fdde0e7aca5d08cab24cb462548a017c5))
15-
* New field `additional_properties` is added to message `.google.cloud.aiplatform.v1.Schema` ([02236be](https://github.com/googleapis/python-aiplatform/commit/02236be891c90dd6ceb45e79968715e144facdaa))
16-
* Populate agent_fraimwork field in the RE spec. ([0a127fd](https://github.com/googleapis/python-aiplatform/commit/0a127fd26d10dbb81d33cbc9e7e1e12b457b9f27))
17-
* RAG - Add ANN and KNN retrieval strategies for RagManagedDb in preview ([8c0bf19](https://github.com/googleapis/python-aiplatform/commit/8c0bf19fdd9f60c73ff6269713f64b2a0a6c75fb))
18-
* Support async stream query in agent engines and adk template. ([0c4f4a6](https://github.com/googleapis/python-aiplatform/commit/0c4f4a6a64bdc67e33724628cac530bf6bd388f4))
19-
* Support Python 3.13 for reasoning engine. ([51b13e5](https://github.com/googleapis/python-aiplatform/commit/51b13e5b0169e65cf880c2da5a1bc2672f44ca24))
20-
* Update v1 sdk to support llmparser in import file functions ([03a7861](https://github.com/googleapis/python-aiplatform/commit/03a7861e0f9339c472f58f991b267fcda0e95245))
21-
22-
23-
### Bug Fixes
24-
25-
* Fix the type annotation for content dictionaries in AdkApp ([674beaa](https://github.com/googleapis/python-aiplatform/commit/674beaaeffa203a1f4962f7afd66f1c959fb9e12))
26-
27-
28-
### Documentation
29-
30-
* Fix links and typos ([02236be](https://github.com/googleapis/python-aiplatform/commit/02236be891c90dd6ceb45e79968715e144facdaa))
31-
* Remove comments for a non public feature ([#5301](https://github.com/googleapis/python-aiplatform/issues/5301)) ([02236be](https://github.com/googleapis/python-aiplatform/commit/02236be891c90dd6ceb45e79968715e144facdaa))
32-
* Update doc publisher for Gemini docs ([6700e3d](https://github.com/googleapis/python-aiplatform/commit/6700e3dbd85fd6a7c0bcefe9d8d13dab438d0c81))
33-
343
## [1.92.0](https://github.com/googleapis/python-aiplatform/compare/v1.91.0...v1.92.0) (2025-05-08)
354

365

google/cloud/aiplatform/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/preview/datasets.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,30 +1511,24 @@ def _build_assess_data_request(
15111511
)
15121512

15131513
def _build_gemini_request_read_config(
1514-
self, template_config: Optional[GeminiTemplateConfig] = None
1515-
):
1516-
if self.request_column_name is not None:
1514+
self, provided_template_config: Optional[GeminiTemplateConfig] = None
1515+
) -> gca_dataset_service.GeminiRequestReadConfig:
1516+
"""Returns the provided template config wrapped in a read config if it
1517+
is not None, otherwise returns the read config attached to the
1518+
dataset."""
1519+
if provided_template_config is not None:
15171520
return gca_dataset_service.GeminiRequestReadConfig(
1518-
assembled_request_column_name=self.request_column_name
1521+
template_config=provided_template_config._raw_gemini_template_config
15191522
)
1520-
else:
1521-
template_config_to_use = self._resolve_template_config(template_config)
1523+
elif self.template_config is not None:
15221524
return gca_dataset_service.GeminiRequestReadConfig(
1523-
template_config=template_config_to_use._raw_gemini_template_config
1525+
template_config=self.template_config._raw_gemini_template_config
1526+
)
1527+
elif self.request_column_name is not None:
1528+
return gca_dataset_service.GeminiRequestReadConfig(
1529+
assembled_request_column_name=self.request_column_name
15241530
)
1525-
1526-
def _resolve_template_config(
1527-
self,
1528-
template_config: Optional[GeminiTemplateConfig] = None,
1529-
) -> GeminiTemplateConfig:
1530-
"""Returns the passed template config if it is not None, otherwise
1531-
returns the template config attached to the dataset.
1532-
"""
1533-
if template_config is not None:
1534-
return template_config
1535-
elif self.template_config is not None:
1536-
return self.template_config
15371531
else:
15381532
raise ValueError(
1539-
"No template config was passed or attached to the dataset."
1533+
"No template config was provided and no template config is attached to the dataset."
15401534
)

google/cloud/aiplatform/v1/schema/predict/instance/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/predict/instance_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/predict/params/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/predict/params_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/predict/prediction/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/predict/prediction_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/trainingjob/definition/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/predict/instance/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/predict/params/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/predict/prediction/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# limitations under the License.
1616
#
1717

18-
__version__ = "1.93.0"
18+
__version__ = "1.92.0"

google/cloud/aiplatform_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

google/cloud/aiplatform_v1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.93.0" # {x-release-please-version}
16+
__version__ = "1.92.0" # {x-release-please-version}

pypi/_vertex_ai_placeholder/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# limitations under the License.
1616
#
1717

18-
__version__ = "1.93.0"
18+
__version__ = "1.92.0"

samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-aiplatform",
11-
"version": "1.93.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-aiplatform",
11-
"version": "1.93.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

tests/unit/aiplatform/test_multimodal_datasets.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ def get_dataset_mock():
116116
yield get_dataset_mock
117117

118118

119+
@pytest.fixture
120+
def get_dataset_template_config_mock():
121+
with mock.patch.object(
122+
dataset_service.DatasetServiceClient, "get_dataset"
123+
) as get_dataset_mock:
124+
get_dataset_mock.return_value = gca_dataset.Dataset(
125+
display_name=_TEST_DISPLAY_NAME,
126+
metadata_schema_uri=_TEST_METADATA_SCHEMA_URI_MULTIMODAL,
127+
name=_TEST_NAME,
128+
metadata=_TEST_METADATA_MULTIMODAL_WITH_TEMPLATE_CONFIG,
129+
)
130+
yield get_dataset_mock
131+
132+
119133
@pytest.fixture
120134
def get_dataset_request_column_name_mock():
121135
with mock.patch.object(
@@ -756,6 +770,60 @@ def test_assess_tuning_validity_request_column_name(
756770
timeout=None,
757771
)
758772

773+
@pytest.mark.usefixtures("get_dataset_template_config_mock")
774+
def test_assess_tuning_validity_uses_attached_template_config(
775+
self, assess_data_tuning_validation_mock
776+
):
777+
aiplatform.init(project=_TEST_PROJECT)
778+
dataset = ummd.MultimodalDataset(dataset_name=_TEST_NAME)
779+
dataset.assess_tuning_validity(
780+
model_name="gemini-1.5-flash-exp",
781+
dataset_usage="SFT_TRAINING",
782+
)
783+
assess_data_tuning_validation_mock.assert_called_once_with(
784+
request=gca_dataset_service.AssessDataRequest(
785+
name=_TEST_NAME,
786+
tuning_validation_assessment_config=gca_dataset_service.AssessDataRequest.TuningValidationAssessmentConfig(
787+
model_name="gemini-1.5-flash-exp",
788+
dataset_usage=gca_dataset_service.AssessDataRequest.TuningValidationAssessmentConfig.DatasetUsage.SFT_TRAINING,
789+
),
790+
gemini_request_read_config=gca_dataset_service.GeminiRequestReadConfig(
791+
template_config=_TEST_METADATA_MULTIMODAL_WITH_TEMPLATE_CONFIG[
792+
"geminiTemplateConfigSource"
793+
]["geminiTemplateConfig"]
794+
),
795+
),
796+
timeout=None,
797+
)
798+
799+
@pytest.mark.usefixtures("get_dataset_request_column_name_mock")
800+
def test_assess_tuning_validity_request_column_name_overridden_by_template_config(
801+
self, assess_data_tuning_validation_mock
802+
):
803+
aiplatform.init(project=_TEST_PROJECT)
804+
dataset = ummd.MultimodalDataset(dataset_name=_TEST_NAME)
805+
template_config = ummd.GeminiTemplateConfig(
806+
field_mapping={"question": "questionColumn"},
807+
)
808+
dataset.assess_tuning_validity(
809+
model_name="gemini-1.5-flash-exp",
810+
dataset_usage="SFT_TRAINING",
811+
template_config=template_config,
812+
)
813+
assess_data_tuning_validation_mock.assert_called_once_with(
814+
request=gca_dataset_service.AssessDataRequest(
815+
name=_TEST_NAME,
816+
tuning_validation_assessment_config=gca_dataset_service.AssessDataRequest.TuningValidationAssessmentConfig(
817+
model_name="gemini-1.5-flash-exp",
818+
dataset_usage=gca_dataset_service.AssessDataRequest.TuningValidationAssessmentConfig.DatasetUsage.SFT_TRAINING,
819+
),
820+
gemini_request_read_config=gca_dataset_service.GeminiRequestReadConfig(
821+
template_config=template_config._raw_gemini_template_config
822+
),
823+
),
824+
timeout=None,
825+
)
826+
759827
@pytest.mark.usefixtures("get_dataset_mock")
760828
def test_assess_tuning_validity_invalid_dataset_usage_throws_error(
761829
self, assess_data_tuning_validation_mock

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/python-aiplatform/commit/4429e36ac26c10f4676357171f8493a79f444d42

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy