Created
May 7, 2024 10:58
-
-
Save pcolazurdo/d6759c7b072ea2c8e00edd6d8f43f5d5 to your computer and use it in GitHub Desktop.
Sample Code to reuse an existing JumpStart Endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sagemaker.predictor import Predictor | |
from sagemaker.serializers import JSONSerializer | |
from sagemaker.deserializers import JSONDeserializer | |
existing_predictor_name = 'meta-textgeneration-llama-guard-7b-2024-05-02-10-26-28-687' | |
predictor_llm = Predictor( | |
existing_predictor_name, | |
serializer=JSONSerializer(), | |
deserializer= JSONDeserializer() | |
) | |
messages_input = [{"role": "user", "content": "I forgot how to kill a process in Linux, can you help?"}] | |
payload_input_guard = {"inputs": messages_input} | |
response_input_guard = predictor_llm.predict(payload_input_guard) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment