# SageMaker JumpStart provides APIs as part of SageMaker SDK that allow you to deploy and fine-tune models in network isolation using scripts that SageMaker maintains.

from sagemaker.jumpstart.model import JumpStartModel


model_id = "meta-textgenerationneuron-llama-2-7b-f"

model = JumpStartModel(model_id=model_id, instance_type="ml.inf2.8xlarge")
payload = model.retrieve_example_payload()

# You must manually accept the end-user license agreement (EULA) to deploy the model.
accept_eula = False

if accept_eula:
    predictor = model.deploy(accept_eula=accept_eula)

    try:
        response = predictor.predict(payload)
    except Exception as e:
        response = str(e)
    print(response)