Skip to main content

AI Prompts

Feature overview

With AI Prompts, our Importer enables AI-powered bulk edits directly in the review step. Users can transform values using natural language, with JavaScript functions generated and executed in the browser, ensuring your data never leaves it.

Benefits

  • Execute bulk edits for data cleaning faster, without writing custom code
  • Keep all uploaded data inside the browser — only the prompt and target data model are processed on our servers
  • Reduce development workload by enabling users to handle their own data cleaning
  • Support a wide range of common data transformation scenarios
  • Complement the Contextual Engine and Cleaning Assistant for comprehensive data transformation and cleaning

How it works

  1. The user selects a column in the review step
  2. Enters a prompt describing the desired transformation
  3. The importer generates a JavaScript function that applies the described operation to the values of the selected column

Prompt: "Merge @First Name and @Last Name together with a space"

Functionality

  • Cleanings are executed once for each entry in the selected column
  • When another column is referenced, the current values in that column are used
  • If a value in a referenced column changes, the value in the cleaned column is not updated automatically
  • Changes are not automatically (re)applied to manually added rows or modified data
  • When a cleaning is applied, onEntryChange is called using the actionType "applyPrompt" or "removePrompt"

Column availability

For cleanings to work properly, ensure that all columns required for the cleaning are available in the review step. There are two ways to achieve this:

  1. Known output columns: Add all necessary columns to the target data model
  2. Unknown output columns: Enable allowCustomColumns in the importer settings to allow users to add the required columns

In both cases, filter out any columns in onResults that were added solely for cleaning purposes but should not be included in the final output.

Helper functions

Alongside standard JavaScript, the Function field supports a fixed set of helpers for removing rows.

HelperRemoves
REMOVE_ROW()The current row, when a given condition is met
REMOVE_DUPLICATE_ROWS()Rows that duplicate an earlier row across all visible columns
REMOVE_DUPLICATE_ROWS_BY(...)Rows that duplicate an earlier row across the listed columns
REMOVE_EMPTY_ROWS()Rows in which every visible column is empty
REMOVE_EMPTY_ROWS_BY(...)Rows in which every listed column is empty

Conditional removal

REMOVE_ROW() is evaluated row by row. It can only be used as the result of a condition, never as the condition itself or as part of a calculation:

@Stock === 0 ? REMOVE_ROW() : @Status

Sheet-wide helpers

The REMOVE_DUPLICATE_ROWS and REMOVE_EMPTY_ROWS helpers act on the whole sheet. When one of them is used, it must be the only content of the function, so it cannot be combined with another helper, a condition, or any other JavaScript.

The _BY variants require at least one column, referenced with @Column label. The variants without _BY compare every column that is currently visible in the review step.

Two optional flags can be passed to the duplicate helpers only. They can be listed in any order.

FlagEffect
IGNORE_CASECompares text values regardless of upper or lower case
IGNORE_BLANKSNever removes a row that has a blank value in any of the compared columns
REMOVE_DUPLICATE_ROWS()
REMOVE_DUPLICATE_ROWS_BY(@Product ID, IGNORE_CASE, IGNORE_BLANKS)
REMOVE_EMPTY_ROWS()
REMOVE_EMPTY_ROWS_BY(@Email, @Phone)
info

Every helper scans only the rows that are currently visible in the review step, so active filters limit its scope. Example rows shown through enableExamples are never removed.

Implementation details

Enabling the feature

Enable the feature in the settings object in the DataImporter component by adding prompts and setting it to true. If this feature isn't part of your plan, contact our sales team or customer success team to get it unlocked.

Prompt examples

  • Users can access 3–5 predefined prompts as well as 3–5 function examples
  • You can customize these examples via i18n
  • Each example can be tailored to specific use cases
  • Users can then use these examples as a guide to write their own prompts

Add examples for prompts using these i18n keys:

"txt_prompts_prompt_example_1"
"txt_prompts_prompt_example_2"
"txt_prompts_prompt_example_3"
"txt_prompts_prompt_example_4"
"txt_prompts_prompt_example_5"

Add examples for functions using these i18n keys:

"txt_prompts_function_example_1"
"txt_prompts_function_example_2"
"txt_prompts_function_example_3"
"txt_prompts_function_example_4"
"txt_prompts_function_example_5"