Skip to content

Commit c1fa49f

Browse files
fthoelecopybara-github
authored andcommitted
chore: Add a system test for using prompt management as template config
PiperOrigin-RevId: 745916786
1 parent 9814768 commit c1fa49f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: tests/system/aiplatform/test_multimodal_dataset.py

+20
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from google.cloud import aiplatform
2525
from google.cloud.aiplatform import initializer
2626
from google.cloud.aiplatform.preview import datasets
27+
from vertexai.preview import prompts
2728

2829
from tests.system.aiplatform import e2e_base
2930

@@ -214,3 +215,22 @@ def test_assess_tuning_resources(self, shared_state):
214215
assert tuning_resources.token_count > 0
215216
finally:
216217
ds.delete()
218+
219+
def test_attach_prompt_as_template_config(self, shared_state):
220+
assert shared_state["bigquery_test_table"]
221+
bigquery_table = f"bq://{shared_state['bigquery_test_table']}"
222+
223+
try:
224+
ds = datasets.MultimodalDataset.from_bigquery(bigquery_uri=bigquery_table)
225+
prompt = prompts.create_version(
226+
prompts.Prompt(prompt_data="Tell me about this species: {species}")
227+
)
228+
ds.attach_template_config(prompt=prompt)
229+
230+
_, bf = ds.assemble()
231+
assert len(bf) > 0
232+
request = bf.iloc[0]["request"]
233+
assert "Tell me about this species: " in request
234+
finally:
235+
ds.delete()
236+
prompts.delete(prompt.prompt_id)

0 commit comments

Comments
 (0)