File tree Expand file tree Collapse file tree
google/cloud/aiplatform/preview Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1288,6 +1288,11 @@ def attach_template_config(
12881288 )
12891289 return self
12901290
1291+ def has_template_config (self ) -> bool :
1292+ """Returns true if the dataset has a template config attached."""
1293+ self ._assert_gca_resource_is_available ()
1294+ return _GEMINI_TEMPLATE_CONFIG_SOURCE_FIELD in self ._gca_resource .metadata
1295+
12911296 @property
12921297 def template_config (self ) -> Optional [GeminiTemplateConfig ]:
12931298 """Return a copy of the template config attached to this dataset."""
Original file line number Diff line number Diff line change @@ -749,6 +749,18 @@ def test_attach_template_config_with_prompt(
749749 timeout = None ,
750750 )
751751
752+ @pytest .mark .usefixtures ("get_dataset_mock" )
753+ def test_has_template_config (self , update_dataset_with_template_config_mock ):
754+ aiplatform .init (project = _TEST_PROJECT )
755+ dataset = ummd .MultimodalDataset (dataset_name = _TEST_NAME )
756+ template_config = ummd .GeminiTemplateConfig (
757+ field_mapping = {"question" : "questionColumn" },
758+ )
759+ assert dataset .has_template_config () is False
760+ # Attach a template config to the dataset.
761+ dataset .attach_template_config (template_config = template_config )
762+ assert dataset .has_template_config () is True
763+
752764 @pytest .mark .usefixtures (
753765 "get_dataset_with_prompt_resource_mock" , "prompts_get_mock"
754766 )
You can’t perform that action at this time.
0 commit comments