Generative AI

The Generative AI task allows generating text directly inside a flow from a prompt, using a Large Language Model. Unlike the Agentic AI task, it does not reason over multiple steps and cannot call external Rulex modules as tools: it only performs the generation itself. It may be useful in cases where the user wants to simply generate text from a prompt, in a faster way, preventing the model to use further tokens in the agentic multi-hop approach.

Once opened, the task interface is divided into two tabs:

  • The Options tab, which covers the core setup: connecting to the AI provider, writing the prompt and configuring the memory behavior.

  • The Advanced tab, which allows the task to return a structured, dataset-like output instead of plain text.

Warning

Always remember to save and compute the task.


The Options tab

The Options tab follows the structure described in the Natural Language tasks family page, for the Model controller and its common connection parameters.

Prompt options

Once the connection parameters have been set, the following options can be configured:

  • Prompt: the instructions given to the model, describing the text to generate.

  • Use memory: if enabled, the task continues a conversation started in a previous task of this family, so that it is aware of what has been discussed earlier instead of starting from a blank status.

Note

Since the Generative AI task does not have a dedicated Tools tab, both the input dataset and any configured context are not selected through dedicated fields, but referenced directly inside the Prompt by using dedicated placeholders:

  • $(dataset): it is replaced with the content of the dataset provided as input to the task.

  • $(context_<name>): it is replaced with the content of the context named <name>, embedded in the AI Model configuration used by the task.

See also

For more information about configuring a context and the embedding model needed to enable it, see the corresponding section of the AI Model resource page.


The Advanced tab

By default, the task answers with plain text. The Advanced tab allows configuring it to return a structured output instead, which is useful when the output has to be passed to other tasks.

  • Output as dataset: if enabled, the task returns its answer as a dataset rather than as plain text.

  • Dataset description: a description of the dataset expected as output.

  • Columns: for each column of the expected output dataset, a Name and a short Description of what it should contain must be provided. You can add new columns by clicking on the Plus button.


Outputs

Once the task has finished running, the task produces, in addition to the configured Dataset output if the Advanced tab is configured, two more outputs: the Conversation and the Results.

Note

In case the Advanced tab is not configured to return a dataset, the original input dataset is forwarded to the next tasks untouched.

Conversation

The Conversation output shows the full exchange that took place during the execution, broken down by role:

  • The user entries show the input sent to the model, i.e. the prompt, with any $(dataset) or $(context_<name>) placeholder already resolved.

  • The agent entries show the generated answer.

See also

If the Use memory option is enabled in the Options tab, the conversation is not re-initiated at the beginning of the task. It will contain therefore any previous interaction, and it is ready to be used by another task of this family later on, so that the new task can work with the full context of everything that was said before.

If the Conversation is converted in a dataset, by using the Convert structure to dataset task, it will contain the following columns:

  • Role: the role of the entry, which can be either user or agent.

  • Content: the content of the entry, i.e. the prompt or the generated answer, depending on the role.

  • Token: the number of tokens used for that entry, which is useful to understand how many tokens were used in total and how many are left before reaching the maximum allowed by the model.

The Conversation output is also shown in tabular form in the Conversation tab of the task if the task is computed.

Results

The Results output summarizes how the execution went, and contains a token summary, with the prompt tokens, the response tokens and the total tokens used.

Results can be used to generally understand the model performance and the number of tokens used.


Example

  • In the Options tab, choose an AI provider, fill in the connection parameters, and write a prompt such as: “Given the following dataset $(dataset), and using the documentation contained in $(context_PlantDocs), write a short description of each plant.”

  • In the Advanced tab, enable Output as dataset and define two columns: Plant and Description.

  • Save and compute the task.

Since the output has been configured to be a dataset, the result is a dataset with one row per plant, containing, for each of them, a generated description based on the input data and the retrieved context.