# 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 = JumpStartModel(model_id="meta-textgeneration-llama-codellama-70b")
example_payloads = model.retrieve_all_examples()

# 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)

    for payload in example_payloads:
        response = predictor.predict(payload.body)
        prompt = payload.body[payload.prompt_key]
        generated_text = response[0]["generated_text"]
        print("\nInput\n", prompt, "\n\nOutput\n\n", generated_text, "\n\n===============")
