Generating Queries and Widgets

Generate Queries

To generate a query, first navigate to the Generate Query page via the left navbar.

../../_images/generate_query.png

Enter a prompt for a query in the form of a statement or question. The Tips box on the right side of the page gives you some ideas. If you would like to see more ideas, click Generate Ideas to produce some suggestions.

Next, select the model you would like to query from the Digital Twin Model dropdown list.

Now, choose if you would like to enable trend and anomaly detection for the query. You can learn more about this feature in the Trend and Anomaly Detection section of this guide.

Finally, click Generate Query to create the query. If generation succeeds, you will be automatically redirected to the query results. If generation fails, an error message will explain why the AI Assistant could not understand your prompt.

Generate Widgets

To generate a widget, first navigate to the Dashboard page and click on an empty slot to place a new widget. (Create a new row if necessary).

You will be redirected to the Add Widget page. Click the Generate Widget tab near the top of the page to switch to Generate mode.

../../_images/generate_widget.png

Enter a prompt for a widget in the form of a statement or question. The Tips box on the right side of the page gives you some ideas. If you would like to see more ideas, click Generate Ideas to produce some suggestions.

Next, select the model you would like to generate a widget for from the Digital Twin Model dropdown list.

Now, choose if you would like to enable trend and anomaly detection for the widget. You can learn more about this feature in the Trend and Anomaly Detection section of this guide.

Finally, click Generate Widget to create the widget. If generation succeeds, you will be automatically redirected to the Dashboard page, where the widget will appear. If generation fails, an error message will explain why the AI Assistant could not understand your prompt.

Open-Ended Query and Widget Generation

In additiona to the methods above, you can also generate queries and widgets for a given model through open-ended chat. To access this page, go to Models, click a model name to view its details, and switch to the AI Assistant tab. Ask a question or make a request, and the AI Assistant will determine if a query and/or widget can be generated to answer it. Click on the Assistant’s proposed query or widget to generate it. To ask another question or revise your prompt, choose Ask Something Else.

../../_images/model_ai_assistant.png

Manage AI-Generated Queries and Widgets

AI-generated queries and widgets appear alongside your manually-created queries and widgets on the query results and dashboard pages, respectively. You can identify them by a light blue sparkle icon (sparkle_icon) next to the query or widget name.

To edit or delete an AI-generated query, go to the Manage Queries page and edit the query as usual. To edit or delete an AI-generated widget, go to the Manage Widgets page and edit as usual.

General Guidance for AI Prompts

The AI assistant is able to make sense of most prompts, as long as they are coherent and relevant to the model. However, if it is consistently giving an error or not producing the expected query/widget, consider the tips below.

  • For best results, try to be as clear and specific as possible. Subjective or qualitative prompts may not produce the expected results (see examples below).

  • If possible, refer to names of properties as they are specified in your model.

  • If possible, use the same formatting for values that is used in your model. For example, if you have a property US_State that uses 2-letter abbreviations, use the 2-letter abbreviation instead of the full state name in your prompt.

  • If you want the AI Assistant to use a specific title for a query/widget, you can include that in your prompt.

  • For widgets, keep in mind the possible operators (min, max, avg, count, sum) and use these in your prompt. Asking for a type of widget that is not supported will not work.

  • For widgets, if you would like a specific type of chart (e.g. pie, column), you can specify that in the prompt.

  • As with queries and widgets created manually, AI-generated queries and widgets can only correspond to a single model. Queries and widgets that make reference to multiple models are not possible at this time.

  • Complete sentences, grammar, and politeness have little to no effect on the quality of output. For example, “Please show me a map of all the vehicles in WA” and “map vehicles in WA” are equivalent. The important thing is that the AI Assistant can extract all the information it needs to make a query or widget based on the selected model.

Examples

Good Query Prompt: “Show all vehicles with currentStatus Active and speed greater than 80”
This prompt uses the exact name and value of a model property (currentStatus Active) and an objective constraint for speed, which the AI Assistant can easily translate into where clauses.

Bad Query Prompt: “Show all vehicles that are going too fast”
This prompt uses a subjective statement. The AI Assistant’s interpretation of “too fast” might differ from yours.

Good Widget Prompt: “Make a bar chart of average speed by state in WA, OR, and CA”
The AI Assistant can easily extract the desired aggregation operator, group-by field, and where clause from this statement.

Bad Widget Prompt: “Make a chloropleth map of standard deviation of speed in southern states”
This prompt asks for an unsupported visualization type (chloropleth map) and operator (standard deviation), with an ambiguous constraint (“southern states”)