code: def test_happy_tgi_sagemaker_endpoint(
      happy_model_builder, gpu_instance_type
  ):
      logger.info("Running in SAGEMAKER_ENDPOINT mode...")
      caught_ex = None
  
      model = happy_model_builder.build()
  
      with timeout(minutes=SERVE_SAGEMAKER_ENDPOINT_TIMEOUT):
          try:
              logger.info(
                  "Deploying and predicting in SAGEMAKER_ENDPOINT mode..."
              )
              predictor = model.deploy(
                  instance_type=gpu_instance_type,
                  endpoint_logging=False,
              )
              logger.info("Endpoint successfully deployed.")
  
              updated_sample_input = (
                  happy_model_builder.schema_builder.sample_input
              )
  
              predictor.predict(updated_sample_input)
          except Exception as e:
              caught_ex = e
          finally:
              cleanup_model_resources(
                  sagemaker_session=happy_model_builder.sagemaker_session,
                  model_name=model.name,
                  endpoint_name=model.endpoint_name,
              )
              if caught_ex:
                  raise caught_ex
  
file_path: sagemaker-python-sdk/tests/integ/sagemaker/serve/test_serve_js_happy.py
imports: from __future__ import absolute_import
  import pytest
  from sagemaker.serve.builder.model_builder import ModelBuilder
  from sagemaker.serve.builder.schema_builder import SchemaBuilder
  from tests.integ.sagemaker.serve.constants import SERVE_SAGEMAKER_ENDPOINT_TIMEOUT, NOT_RUNNING_ON_PY310
  from tests.integ.timeout import timeout
  from tests.integ.utils import cleanup_model_resources
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: test_happy_tgi_sagemaker_endpoint(happy_model_builder, gpu_instance_type) without return types