Skip to content

Commit 19c3a36

Browse files
committed
fix: Adding test for tags
1 parent d9c0c6e commit 19c3a36

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/integ/sagemaker/jumpstart/model/test_jumpstart_model.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,45 @@ def test_jumpstart_session_with_config_name():
416416
"md/js_model_id#meta-textgeneration-llama-2-7b md/js_model_ver#* md/js_config#tgi"
417417
in mock_make_request.call_args[0][1]["headers"]["User-Agent"]
418418
)
419+
420+
421+
def test_proprietary_model_from_hub_service(setup):
422+
423+
model_id = "upstage-solar-mini-chat"
424+
425+
model = JumpStartModel(
426+
model_id=model_id,
427+
hub_name="SageMakerPublicHub",
428+
role=get_sm_session().get_caller_identity_arn(),
429+
sagemaker_session=get_sm_session(),
430+
)
431+
432+
predictor = model.deploy(
433+
tags=[{"Key": JUMPSTART_TAG, "Value": os.environ[ENV_VAR_JUMPSTART_SDK_TEST_SUITE_ID]}]
434+
)
435+
payload = {"prompt": "To be, or", "maxTokens": 4, "temperature": 0, "numResults": 1}
436+
437+
response = predictor.predict(payload)
438+
439+
assert response is not None
440+
441+
def test_bedrock_store_model_tags_from_hub_service(setup):
442+
443+
model_id = "huggingface-llm-gemma-2b-instruct"
444+
445+
model = JumpStartModel(
446+
model_id=model_id,
447+
hub_name="SageMakerPublicHub",
448+
role=get_sm_session().get_caller_identity_arn(),
449+
sagemaker_session=get_sm_session(),
450+
)
451+
452+
predictor = model.deploy(
453+
tags=[{"Key": JUMPSTART_TAG, "Value": os.environ[ENV_VAR_JUMPSTART_SDK_TEST_SUITE_ID]}],
454+
accept_eula=True
455+
)
456+
457+
endpoint_arn = f'arn:aws:sagemaker:{get_sm_session().boto_region_name}:{get_sm_session().account_id()}:endpoint/{predictor.endpoint_name}'
458+
tags = get_sm_session().list_tags(endpoint_arn)
459+
expected_tag = {"Key": 'sagemaker-sdk:bedrock', "Value": 'compatible'}
460+
assert expected_tag in tags

0 commit comments

Comments
 (0)