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 discoveries, calculations, presentations, and 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").

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.

Using Synonyms

Synonyms make it easier for users to use multiple, well known terms to describe what they are looking for in their analysis questions without needing to train everybody on a strict set of relevant words of phrases. Pyramid has numerous venues to set and manage synonyms for NLQ: some by admins, some by end users, and some are resolved by GenAI LLMs automatically.

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.
  • Click here for more details on advanced intelligence

Business Logic Intelligence (NLQ)

You can use the Chatbot to describe your calculations (formulas, lists, or columns) using natural language. If the metric exists in the metric store, the AI agents can retrieve and use the metric in the response and query. You can also create new calculations in both Formulate and in Discover. In Formulate, you are creating a standalone calculation. In Discover, you are either adding an existing calculation or creating a new calculation as part of your visual creation.

  • Click here for more details on using business logic and the metrics store

Granular Questions and Vectorization

Pyramid facilitates the use of granular data elements in NLQs when vectorization has been implemented on the related semantic model. This allows end-users the freedom to ask ANY analytical or data centric question using specific details in a customer's data, using NLQ via the Chatbot interface and AI agents, and get an intelligent, insightful response.

  • Click here for more details on asking granular questions

Adjusting Visualizations

When you are building visuals, Pyramid's Smart Visualization engine chooses which type 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 tell the Chatbot to use a different visual type (including changing the visualization used at runtime). For example:

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