Writing Natural Language Queries

Natural Language Querying (NLQ) can be triggered by typing or saying questions in natural language into the Chatbot at Design time or Runtime. These queries are typically simple statements describing the changes that you want to make to your visuals, presentations, or publications. This section of the guide describes how best to write your questions (or "prompts") to get the most out of the Chatbot.

Important: "Chatting" will work against any supported database (both SQL or MDX). It's as simple as typing or saying your question and hitting Enter.

Remember: The Chatbot allows you to ask subsequent questions that adjust the original query, regardless of how the original was initially generated. In this way, the Chatbot is mostly cumulative. You can enter a series of follow up questions and the previous stage is updated accordingly, without a reset or undo of anything. This allows you to explore your data in an intuitive and spontaneous way, quickly adding, adjusting, or removing items as required.

Importantly, the Chatbot does not change the selected visualization. It draws the results of the changes using the currently selected visual, unless a new chat session is triggered (reset or restart), or you \redraw or explicitly change the visual type that you want to see ("show as pie chart").

NLQ: Asking a Basic Question

The basic elements of writing functional NLQ questions. You can build extremely sophisticated analytical content with fairly straightforward, natural language questions, like:

  • Show sales by promotion.
  • Add returns and net profit.
  • Show sales and expenses by promotion and gender.

Note: This describes general tips for question writing. If you are using the Pyramid Internal engine (PLM) to drive your Chatbot and AI functionality, there is more specific information that is relevant to question writing. See Portable Language Model Guidance.

NLQ: Advanced Intelligence

Beyond the basics described above, there are specialized capabilities for handling dates and time, geospatial entities, proper nouns, and advanced analytical functions, like:

  • Show sales by promotion this year.
  • Show sales by occupation in California.
  • What will my costs be in the next 12 months?
  • Explain the difference between bike sales in the United States and bike sales in Australia.

NLQ: Visualizations

When you are building visuals in Discover Pro or Lite, Pyramid's Smart Visualization engine chooses which type of visual to create based on the content of your query. (It decides whether your data is best presented as a Pie chart, Grid, or Scatter Chart on your behalf.) If you do not agree that it has chosen the optimal visualization type, or you know in advance what type of visual you want to create, you can use the Chatbot to specify or change which visual type is used (including changing the visualization used at runtime). For example:

  • Show sales by promotion and gender in a pie.
  • Show as a grid.