AI21 Labs Prompt AI action

AI21 Labs prompt AI action connects automations to Amazon Bedrock AI21 Labs prompt AI functionality. This action enables automations to generate human-quality text, translate languages, write different kinds of creative content, and answer questions in an informative way, all based on user-defined prompts.

Prerequisites

  • You must have the Bot creator role to use the AI21 Labs Prompt AI action in a bot.
  • Ensure that you have the necessary credentials to send a request. For more information on acquiring the credentials, see Amazon Bedrock: Authenticate action.

This example shows how to send a natural language message using the AI21 Labs Prompt AI action and get an appropriate response.

Procedure

  1. In the Control Room, navigate to the Actions pane, select Generative AI > Amazon Bedrock, drag AI21 Labs Prompt AI and place it in the canvas.
  2. Enter or select the following fields:

    Amazon Bedrock AI21 Labs Prompt AI

    1. Enter the Region.
      For information on Region, see Amazon Bedrock GA regions.
    2. Click the Model drop-down and select a model with which to communicate.
      • Jurassic-2 Mid: Jurassic-2 Mid is the mid-sized model in the Jurassic-2 series and is used for a wide range of language comprehension and generation tasks.
      • Jurassic-2 Ultra: Jurassic-2 Ultra is a better model in the Jurassic-2 series, designed for the most complex language generation tasks.
      • Other supported version: To input other supported versions of the above models. For more information, see AI21 Labs Jurassic-2 models schema
      Note: Generative AI packages rely on the specific input/output schema of a model to function correctly. Since different models often have distinct schemas, only versions of the same model can be integrated. For other supported version, consult hyperscaler documentation for supported versions of models.
    3. Enter a Prompt Message to use by the model to generate a response.
    4. Enter the maximum completion length.
      By default, if you do not enter a value, then the maximum completion length is automatically set to keep it within the maximum context length of the selected model by considering the length of the generated response.
    5. Enter a Temperature. This value refers to the randomness of the response. As the temperature approaches zero, the response becomes more specific. The higher the value, the more random is the response.
    6. Enter Default as the session name to limit the session to the current session.
    7. To manage the optional parameters, click the Show more options and select Yes. If you select Yes, you can add other parameters such as: Top P, Add instructions, Presence penalty, Count penalty, Frequency penalty, Penalize special tokens, and Stop sequences. For information about these optional parameters, see Learn Models.
    8. Save the response to a variable. In this example, the response is saved to str_AI21Labs_promptResponse.
  3. Click Run to start the bot.
    You can read the value of the field by printing the response in a Message box action. In this example, str_AI21Labs_promptResponse prints the response.