Generative AI action

Use the Generative AI action to generate the output using the Generative AI functionality in a form at runtime.

Procedure
  1. On the form modeling bar, select Actions and then select New.

    The New action dialog box is displayed.

  2. On the Type list, select Generative AI.
  3. Change the default Name (Generative AI1) to something meaningful.
  4. Optional. Enter a Description for the action.
  5. On the Provider list, select the Generative AI provider to use, such as OpenAI, AI Agent, Custom LLM, or Azure OpenAI.

    The Provider list includes the providers configured in Integration > Generative AI. See Integrate Generative AI with TotalAgility.

    Alternatively, select to provide an inline value, or select a form control, a form variable, or a global variable.

    If you select an AI Agent provider, lists of (standard and additionally added) input and output variables appear.

    • You can set a static value or dynamic variable (form control, form variable, or global variable) for the input and output variables.

    • The output variable included in the standard variables is used to populate the chat control response.

  6. Configure the Model to use for this action.

    The AI model used by the component depends on the type of provider you select. Providers are listed under the names given when they were configured, so a name such as "ChatGPT" may belong to any type. To check the type of a provider, open it in Integration > Generative AI and look at Type. The name of the property and the options it offers vary by provider type:

    Provider type Model property

    Tungsten

    The property is labelled Model and a list is displayed, set to Default. Do one of the following:

    • Keep Default to use the model configured in System > System settings > System > Tungsten AI > Model.

    • Select a specific model to use for this component only.

    • Select to provide an inline value, a String-compatible variable or a server variable that contains the model name.

    OpenAI Compatible

    The property is labelled Override model and no list is displayed. Leave it empty to use the model configured at the integration level, or enter the model name to override it. Select to provide the value as a String-compatible process or server variable instead.

    Azure OpenAI

    Not available. The model is part of the URL configured for that provider.

    Custom LLM or AI Agent

    Not available.

    • When you provide an inline value for the Provider, the model cannot be selected from a list, so you must provide an inline value for the model as well. If either value is a variable, it is resolved at runtime.

    • A provider is configured with a standard model and a vision model. The model you specify here overrides the vision model when the component sends an image, and the standard model otherwise.

    • If the configured model has been removed or is otherwise unavailable, the error is raised at runtime, not when you design or publish the component. An invalid model name is not validated: the request is sent as entered.

    • On upgrading or importing from an earlier version, the Model of a component using the Tungsten provider is set to Default. For any other provider, the component continues to use the model configured on that provider's integration.

  7. You can provide input in either way based on the size of the prompt:
    • For a relatively smaller input prompt, in the Input box, provide the input to the form that can be a combination of simple data types (variables, controls, and data object fields). For example, provide a String variable with the value "Which country is hosting the ICC Cricket World Cup, 2023?".

    • For a large and detailed input prompt, such as a block of code, select . In the Editor, enter the prompt and select Save.

      • The text editor supports Markdown content, plain text, variables, or any combination of these.

      • When you use a variable in the prompt, in the text editor the content of the variable appears within two curly brackets. For example, if the variable contains the text "Hello", in the editor it appears as {{Hello}}.

  8. On the Source list, select one of the following options:

    On upgrading TotalAgility from an earlier version, if the Source was set to Inline image, the Source is set to Image.

    Option Description

    None (default)

    The response from the AI provider is based on the input provided (plain text or variables).

    Image

    The response is generated based on the image provided.

    On the Document list, select a form control (Web capture control), form variable, or global variable of type String, and on the Mime type list, select the file type.

    The following mime types are supported: GIF, JPEG, and PNG. (Default: PNG)

    All Generative AI models do not support the use of images, including the Custom LLM.

    Text

    If the document has layout text, such as a semi-structured document (invoice, purchase order, and more) or a fixed form, text format can provide better results when compared to the results returned using a Custom LLM provider.

    On the Document list, select the form control (Web capture control), form variable, or global variable of type String.

    The response is generated based on the document passed as an input at runtime, and the following file types that are supported in the Transformation Designer are supported for the text source format in TotalAgility at runtime.

    • TIFF (*.tif)

    • JPEG (*.jpg)

    • PNG (*.png)

    • PDF

    When you set the source format as text, the standard model configuration is used.

  9. Optional. Select the check box for Use seed (default: Clear) and on the Seed list, provide an inline value or select a numeric variable. (Default: 0 and Maximum: 32,767)

    The seed value increases the likelihood of obtaining more consistent results from the AI provider across repeated requests, though not guaranteed.

  10. On the Response list, select a variable (form or global) , or a form control such as Text box, to hold the response for the provided input.

    The response only supports simple type variables, Data objects, and a list within the Data object.

    Based on the variable type mapped to the response, the result is displayed. For example, if you provide "When did World War II start?" as the input and map a String variable to the response, the result is displayed as "1 September 1939"; however, if you map a Date variable to the response, the result is returned as "01/09/1939".

  11. Select Add.

    The newly created action is added to the table.

  12. Associate the action with the control to trigger this action. See Configure actions for form control events. Alternatively, to call this action for a form event, associate the action with the form. See Associate an action with a form.

    When the Generative AI action is triggered:

    • The output is populated correctly, and an audit entry is recorded that the Generative AI form action is executed. The audit entry includes the provider and the actual model used.

    • The correct image or text is passed to the AI provider as part of the input and the response is returned. For example, upload an image of car registration and request the AI provider to get the registration number as response.

    • You need not save the document in the Web capture control to have the Document ID populated.