Using a generative AI output in a ruleflow

Output of generative AI models that you created can be consumed in a ruleflow. The output is used as a value of a variable that is used in a ruleflow, or its error code or error message can be printed as part of your ruleflow.

Procedure

  1. In the Dependencies tab in your task model, click Add, and select the generative AI model that you want to use.
  2. Open the Artifacts tab, and define the following items:
    1. Click Add variable set to add variables.
    2. Create functions. See Creating functions.
    3. Click Add business rule to add business rules.
      For example:
      then set 'my output variable 1' to generated_text of the GenAI model computed from my GenAI variable being 'my input variable' ;
      then set 'my output variable 2' to generated_token_count of the GenAI model computed from my GenAI variable being 'my input variable' ;
      then print error_code of the GenAI model computed from my GenAI variable being 'my input variable' ;
      then print error_message of the GenAI model computed from my GenAI variable being 'my input variable' ;
      
      In these examples, the following items are used:
      Item Description
      <gen_ai_model> computed from <variable> being Expression.
      GenAI model Generative AI model name.
      my GenAI variable Variable used in the generative AI model.
      my input variable Variable (type string) defined in the variable set and set as an input parameter in the function for the ruleflow.
      my output variable 1 Variable (type string) defined in the variable set and set as an output parameter in the function for the ruleflow.
      my output variable 2 Variable (type integer) defined in the variable set and set as an output parameter in the function for the ruleflow.
    4. In your ruleflow, click the Open ruleflow button, and select the rule task node that you want to add your business rule to. In the Logic pane, click Select artifacts, and select the business rule that you created.