Examples for using Jurassic-2 models through Amazon SageMaker.
You can install the package using pip:
pip install -U "ai21[AWS]"
And then import the package:
import ai21
In order to use this library, you must configure your AWS credentials.
All set up? Make your first interaction with Jurassic-2:
response = ai21.Completion.execute(destination=ai21.SageMakerDestination("j2-ultra"),
prompt="To be, or",
maxTokens=4,
temperature=0)
print(response['completions'][0]['data']['text'])
# not to be: that is the question
For more comprehensive quickstart guides, see:
AI21 Grammatical Error Correction (GEC)
AI21 Studio playground - no code environment to test and perfect your prompts