In addition to Displayr's Text Categorization module and auto-relabeling feature, users can access the power of Displayr AI in customizable outputs and variables. This article covers those features found in the AI menus when inserting variables and outputs.
- Customizing AI features
- Creating outputs on or off a Page in the Report
- AI-Generated variables
- Save customized AI widgets as templates
Customizing AI features
Displayr has built-in features that allow users to create their own AI outputs and variables. Each feature is created with a default prompt (query sent to the bot) and fields (for data and other items), but can be further customized as needed via the object inspector.
The Data tab of the object inspector has the Prompt field, which is the request being sent to the AI. There will be a default prompt for each feature, but you are able to customize it as you wish. Each feature will also have some other default fields based on the output, such as Variables, Tables, Size, and Scaling. For tips on creating custom prompts, see Getting Started with AI Prompting in Displayr.
In addition to these default fields, you can also add your own custom fields and access other settings via the Customize tab. The Temperature field governs how much randomness goes into the result selection, 0-1 (larger values mean it's more "creative"). The Input Options section is how you add more fields to the Data tab if you need to configure other inputs to go along with your Prompt. Here you will select how many additional fields you want to add, give each a name, and specify what type of input it is (i.e., Text, a Control, a Variable, a Table, a Calculation, etc), and set whether multiple items can be selected. The input's name is put inside { } in the Prompt where you want the input to be used.
For example, if I wanted to use the AI widget to generate a summary of a table, the Customize > Input Options would look like below:
Then, tick Show Prompt in Data tab, and the Prompt will appear in the Data tab. You can select the specific input to use to run the AI prompt on:
You can also customize any of these AI features and save them as a template to use elsewhere in the same document or other documents.
Creating outputs on or off a Page in the Report
Users can generate customizable AI outputs that can be placed on pages or be a standalone item in the Report tree. These are accessed via the AI menus when adding an item in the Report tree:
and via the toolbar when working on a Page:
Custom AI Calculation
AI > Custom AI Calculation lets you pass a specific prompt and relevant variables and outputs from your Report to Displayr AI. This can be handy when you want to write dynamic prompts and/or include data that your dashboard viewers can change by filtering. This feature is customizable and can be as simple or as complex as needed. Use this feature when you don't need to summarize outputs, and instead when you have more specific questions about outputs. However, as AI models do not actually execute calculations, results must be carefully scrutinized, and they are not reliable for data calculations that need to be very precise or accurate, or for reporting. If actual calculations are required, it is recommended to perform those using other Displayr features before passing to the AI.
A worked example of how to create an output that interprets a table is below:
- Create a table on a Page in your Report.
- From the toolbar, select AI
> Custom AI Calculation and click on the page next to the table.
- In the object inspector, the Prompt for the output is on the Customize tab by default, but you can check Show Prompt in Data tab to show it on the Data tab along with other inputs.
- Paste the prompt below in the Prompt field. The
{Table}
in the prompt is the placeholder for the table you select in the Table field, which will be created later.Interpret the table below in a concise paragraph.
{Table} - Go to the Description section, and give the output a Name and Description, such as:
Name > Interpret a table
Description > This output will interpret a table, which can be dynamically filtered. - OPTIONAL: In the Output Options section, modify the Temperature setting, which ranges from 0 = deterministic to 1 = most creative. Usually, .3 is a good middle ground.
- OPTIONAL: Modify Output type to be plain Text or HTML (which will be exported to PowerPoint as an image).
- In the Input Options section, create new fields to be shown on the Data tab, which will allow users to select data from your document to use in the prompt. These items are included in the prompt by using the field name inside curly brackets, such as:
{Table}
. For this example, we will make a Table field for a single table. Update Number of inputs to 1. - New fields will appear to create the input. Update Input 1 name to Table and Input 1 type to Table. If needed, check Input 1: allow multiple inputs if you want to select more than one item in this field (we will leave it unchecked in our example).
- Tick Show Prompt in Data tab to allow users to see and modify the prompt from the Data tab.
- On the Data tab, you will see the Prompt and Table fields appear. In the Table dropdown, select the table you created on the page:
- The widget will automatically calculate, and the response will be shown in the final output.
-
OPTIONAL: Refine your Prompt and recalculate until the AI returns a response that is closer to the format you need. For example:
Is there a trend in the data in the table below? Summarize your finding in 4 sentences or less.
{Table} - OPTIONAL: You can create a combo box filter for viewers to filter the table in the Filters & Weight > Filter(s) area of the object inspector and have the commentary update dynamically. Or create filter variables to apply Page filters to the table in View Mode.
Summarize
The AI > Summarize output allows you to feed various items to the output for interpretation via fields in the object inspector > Data tab. There is default text in the Prompt, so no need to come up with your own prompt unless you'd like to tweak what the output returns. By default, you can select Tables, Text, and Calculations, but fields for other types of items can be added to the menu via the Customize tab.
AI-Generated variables
Displayr AI can be used to create variables. This causes whatever prompt you provide to be applied to each row of data in a variable. These work by selecting a variable in the Data Sources tree, clicking +, and selecting an option from the menu. These options include:
Poor Text Data
This will allow you to pass text variables to the AI, along with a prompt including details on how to clean the data, including removing profanity and other forms of non-response.
In the example below, a text variable was selected in the Data Sources tree, and then I clicked Plus + > Data Quality > Poor Text Data. Displayr AI created a new variable in the Data Sources tree that coded cases with bad responses as 1s. You can then check Usable as a filter on this variable in the object inspector, and use it to edit the raw data or remove cases, if necessary.
In some cases, it's the case that the data identified as bad is bad (e.g., "Jajasndnd" as seen below). In other cases, it's not so clear. The prompt can be edited to give better instructions, although sometimes this will be ineffective (due to hallucination or your prompt being insufficiently clear).
Identify Inconsistent Data
Have AI review a variable to make sure it makes sense. In the Data Sources tree, select the variable(s), and click Plus + > Data Quality > Inconsistent Data. AI will assign a value of 0 if the data is consistent, and a value of 1 if the data is inconsistent. Examples of inconsistent data include a category of "Dog" showing up in an Age variable, an observation where someone under 18 has a living arrangement of "Living alone", or a case where a numeric Age variable doesn't fall within the Age category selected. You can use this AI-created variable to manually review the cases that are flagged. Check Usable as a filter to then use it to filter a Table > Raw Data > Variable(s) output to review the data to determine if it should be excluded from your analysis. For example, the table below looks at inconsistent data between the Preferred Cola and Brand Attitude variable sets:
Custom Code > AI
In the Data Sources tree, the Plus + > Custom Code > AI menu creates different types of variables based on a Prompt and Input Variables. The default behavior will do a complete case analysis of the variables selected and will flag cases with complete data. Flags are coded based on the type of variable you want to create:
- Date: Constructs a Date/Time variable that takes today’s date if the data is complete, and is a missing value if there is incomplete data.
- Numeric: Constructs a Numeric variable which takes the value of 1 if the data is complete and 0 if the data has any missing values. You can click Usable as filter in the object inspector to be able to filter in complete cases on outputs and analyses.
- Nominal: Constructs a Nominal variable that takes the label 'Complete' if the data is complete and 'Incomplete' if the data has any missing values.
- Ordinal: Same as 'Nominal' but creates an Ordinal variable.
- Text: Same as 'Nominal' but creates a Text variable.
You can also customize the Prompt via the object inspector to have the AI perform different actions, such as converting numbers stored as a Text variable into an actual Numeric variable. Another example would be to have AI identify mentions of proper names (e.g., brands) in text and then create a new text variable that has only that information in it. It can also flag angry comments about a certain brand.
Sentiment
Use Plus + > Numeric Transformations > Sentiment to create a new variable with a sentiment score generated by AI from an input text variable. This is a more robust analysis than our other built-in sentiment analysis tool, which simply counts positive and negative words in a response. You can determine how the sentiment is coded, and AI will be able to evaluate responses in a "smarter" way.
Translate
Plus + > Text Manipulation > Translate creates a new version of a selected text variable, translated into a different language. You can use the object inspector to further customize your Prompt and select a Source language (including having the AI auto-detect the language).
Save customized AI widgets as templates
Once you've created a customized AI Calculation (widget) to run on outputs in your document, you can save it as a template. This will allow you to apply the same prompt to different outputs in the same document or in other documents since templates are saved to the Displayr Cloud Drive.
To save a customized AI widget:
- Select the output on the page.
- Click the three dots that appear above the output and select Save as Template.
- Give the widget a File name.
- OPTIONAL: Select a folder in the Displayr Cloud Drive to save the template into.
- Click Save.
To insert the saved template into the same document or into a different document:
- Navigate to the page where you want to place the saved prompt.
- From the toolbar, click Template
.
- Select the saved AI widget from the Displayr Cloud Drive list.
- Click Insert.
- Click on the page to place the AI output.
- Select the inputs that you want to run the AI widget on from Tables, Text, Calculations, etc.
- OPTIONAL: Further customize the prompt or items in the Customize tab of the object inspector. Note that if you want to reuse the modified widget, you will need to click Save as Template and give the updated object a new name.
Next
Frequently Asked Questions About Using AI in Displayr