Skip to main content

FlexIt AI

Overview​

FlexIt AI lets you ask questions about a data model in plain language. In SQL mode it writes a SQL query that answers your question (text-to-SQL), which you can run and turn into a report. In Chat mode you can ask general questions about your data model.

Prerequisites​

  • AI integration - an admin must enter a FlexIt AI service API key under Administration > Configuration > Integrations. See Artificial Intelligence. FlexIt AI menu options only appear once a key is set.
  • A dbt data model - FlexIt AI uses metadata that FlexIt sends to the AI service when it loads a data model's dbt metadata. Use a data model created from dbt Cloud or a dbt Docs Server with Real-time Connection enabled. See Connecting to dbt.
  • Role - FlexIt AI is opened from the portal New menu, which is available to admins and authors.

Start FlexIt AI​

  1. In the portal, click New and select FlexIt AI.
  2. Select a data model from the list. You'll only see data models you have permission to.

You can also right-click a data model in the Data Catalog and select Explore in FlexAI.

A New AI Report tab opens with the Ask panel on the left and a SQL editor on the right.

Ask a Question​

  1. Choose a Mode:
    • SQL - get a SQL query that answers your question
    • Chat - ask general questions about your data
  2. Type your question in the Question box, for example total sales by region for last year.
  3. Click Ask. The button shows Working on answer... while the AI service responds.

The answer appears in the editor on the right. SQL answers get SQL highlighting; chat answers appear as plain text. Asking again replaces the editor contents.

Work with the Results​

FlexIt AI does not run the query for you. Review the SQL, edit it if needed, then:

  1. Choose a row limit (1,000 Rows by default) and click Run (F5 or F9). The results appear below the editor.
  2. Click Create Report to open the results as a new SQL report. If you edit the SQL after running it, run it again before creating the report.

Non-admins can't run insert, update, delete, truncate, or drop statements. See SQL Report for more on SQL reports.

AI Context​

Use AI Context to give the AI extra instructions about a data model, such as business definitions, preferred tables, or how to filter for the current term.

  1. Open the data model in the Data Model Editor and click Settings.
  2. Next to AI Context, click Edit Context and enter your text.
  3. Save the data model.

The AI Context is sent with every question asked from New > FlexIt AI for that data model.

What Is Sent to the AI Service​

FlexIt AI requests go from the FlexIt server to the FlexIt AI service at ai.flexitanalytics.com, authenticated with your API key.

  • Metadata - when FlexIt loads a dbt data model's metadata and it has changed, FlexIt sends the data model's metadata (models, columns, and relationships) to the service.
  • Each question - your question, the mode, the data source type (SQL dialect), the data model's AI Context, and an ID for the data model.

Query results are not sent. Queries run against your data source from FlexIt, the same as any other report.

FlexIt AI vs. Natural Language Query​

Natural Language Query (Ask in reports) is a different feature. It builds a report from the data model's fields by matching the words in your question, and doesn't use the AI service or an API key. FlexIt AI writes SQL using the AI service, and the results become a SQL report.