OpenAI: Prompt AI action

The OpenAI: Prompt AI action mimics OpenAI's completions, by taking a prompt as input and returning a model-generated one or more predicted completions.

Prerequisites

  • You must have the Bot creator role to use the OpenAI Prompt AI action in a bot.
  • Ensure that you have the necessary credentials to send a request and have included Authenticate action before calling any OpenAI actions.

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

Procedure

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

    OpenAI Prompt AI

    1. For Authenticate, select Latest version to use the Authenticate action with the API Key.
      If you select To be deprecated, you can authenticate using the API Key without calling the Authenticate action.
      Note: The To be deprecated option will be deprecated in the up coming release.
    2. Enter Default as the session name to confine to the current session.
    3. Select a large language model (LLM) to use for your prompt from the Model dropdown. You can select the following models:
      • gpt-3.5-turbo-instruct (default)
      • babbage-002
      • davinci-002
      • text-davinci-003 (Deprecated - 2024-01-04)
      • text-davinci-002 (Deprecated - 2024-01-04)
      • davinci (Deprecated - 2024-01-04)
      • text-curie-001 (Deprecated - 2024-01-04)
      • curie (Deprecated - 2024-01-04)
      • text-babbage-001 (Deprecated - 2024-01-04)
      • babbage (Deprecated - 2024-01-04)
      • text-ada-001 (Deprecated - 2024-01-04)
      • ada (Deprecated - 2024-01-04)
      • Other supported version to input a supported model. In addition to the models listed above, you can explore a variety of other supported text-based preview models from OpenAI other supported versions (excluding vision models).
    4. Enter a Prompt to use by the model to generate a response.
    5. Enter the maximum number of tokens to generate. By default, if you do not enter a value, then the maximum number of tokens generated is automatically set to keep it within the maximum context length of the selected model by considering the length of generated response.
    6. Enter a Temperature. This value refers to the randomness of the response. As the temperature approaches zero, it makes the response more focused and deterministic. The higher the value, the more random is the response.
    7. To manage the optional parameters, select Yes under Show more options to add other parameters such as: Suffix, Top P, N, Logprobs, Echo, Stop, Presence Penalty, Frequency Penalty, Best of, Logit bias, and User. For information about these optional parameters, see Open AI completions.
    8. Save the response to a variable. In this example, the response is saved to list_OpenAI_prompt_response.
  3. Click Run to start the bot. The output of a prompt is a list where you can set N as the optional parameter , generate multiple prompts for each input. To read the response of the prompt, you can print the response in a Message box action. In this example, the first element of the list list_OpenAI_prompt_response[0] prints the response because N is set to 1.