/SageMaker

Examples for using Jurassic-1 models through Amazon SageMaker

Primary LanguageJupyter Notebook

Deploy AI21 Labs Language Models on AWS SageMaker

Examples for using Jurassic-1 models through Amazon SageMaker.

Installation

You can install the package using pip:

pip install -U "ai21[SM]"

And then import the package:

import ai21

Quickstart

In order to use this library, you must configure your AWS credentials.

All set up? Make your first interaction with Jurassic-1:

response = ai21.Completion.execute(
    sm_endpoint="j1-grande",
    prompt="To be or",
    maxTokens=4,
)

print(response['completions'][0]['data']['text'])
# not to be? That is the question

For more comprehensive quickstart guides, see:

Jurassic-1 Grande | Jurassic-1 Large

Learn more