Skip to main content

Use value dictionaries to improve Genie's accuracy

Preview

This feature is in Public Preview.

This page explains how to improve accuracy in a Genie space by adding value dictionaries. Value dictionaries allow Genie to match values in a user's prompt to actual values in data so that it can generate SQL queries that closely match the user's intent.

Overview

When a user asks a question in Genie, the phrasing is often conversational and can include errors such as misspellings. In these cases, the values in the prompt might not match the structure or values in the data. This can cause Genie to misinterpret the question and generate incorrect SQL.

For example, a user might ask:

"Show me car sales in Florida for Q1."

If the data uses state abbreviations (such as FL), and there isn't a value dictionary for that column, Genie might generate SQL that includes ILIKE '%Florida%', which returns no results.

Adding a value dictionary to the state column allows Genie to access representative values. With this context, Genie can recognize that FL corresponds to “Florida” and generate more accurate SQL.

Without value dictionary

With value dictionary

WHERE state ILIKE '%Florida%'

WHERE state = 'FL'

Value dictionaries help Genie return correct results by improving its ability to generate accurate SQL.

Requirements

Choose columns

By default, the Use sample values from these tables to improve accuracy setting is enabled when you create a space. When this setting is enabled, Genie automatically creates value dictionaries for eligible columns as you add tables to the space. If the number of value dictionaries reaches the space's limit, you can manually adjust which columns are selected after adding new tables.

Users with at least CAN EDIT privileges can set which columns include value dictionaries. For instructions, see Manually select columns.

note

During the Public Preview, a Genie space supports value dictionaries on up to 30 columns. Each dictionary can include up to 255 distinct values, with each value truncated at 127 characters. If a column or row exceeds these limits, only a subset of values is stored. When adding value dictionaries to a group of selected tables, if there are more than 30 eligible string columns, Genie selects a subset automatically. You can manually manage which columns are added as value dictionaries. See Manually select columns.

Manually select columns

Choose string columns that give Genie practical context when interpreting prompts, especially columns with categorical or consistently formatted values. Avoid free-text or unstructured content like user IDs, names, or reviews.

Value dictionaries are stored in your workspace’s storage bucket.

To set which string columns include a value dictionary:

  1. Click Configure > Data in your Genie space.
  2. Click a table name to view its columns.
  3. Click Add value dictionary next to the column you want to include.
  4. Use the Kebab menu kebab menu to refresh or remove a dictionary. See Refresh or remove value dictionaries.

A string column with the value dictionary button on the right.

To cancel an in-progress operation, click the Kebab menu kebab menu next to the Adding value dictionary message.

If the operation fails, click Adding value dictionary failed to retry.

Refresh or remove value dictionaries

Refreshing a dictionary updates its stored values. Refresh the value dictionary if:

  • New values have been added to the column.
  • The format of existing values has changed.

To refresh or remove a value dictionary, click the Kebab menu kebab menu and choose one of the following:

  • Refresh value dictionary to update the stored values.
  • Remove value dictionary to delete the stored values for that column.

Refresh values or remove values options in the UI

How Genie uses value dictionaries

Genie uses your prompt, relevant table metadata and values, errors, as well as input code or queries when generating a response. If Genie uses a column with a value dictionary, the stored values help it to interpret prompts more accurately and generate better SQL. Value dictionaries improve Genie’s accuracy, but they work best alongside clear instructions and example queries. See Curate an effective Genie space for more guidance.