Databricks AI/BI Genie provides an intuitive way to interact with your data. It allows you to ask questions in natural language and receive intelligent responses from your Lakehouse. Genie makes data exploration and business intelligence readily accessible.
This post explains how you can tap into Genie's deeper AI potential. While Genie handles the complexity of query generation, understanding the concepts behind Databricks AI Functions—specialized SQL Functions that Genie can utilize—helps you guide Genie to perform more sophisticated AI-driven analyses and interpret its advanced responses. We will explore how you can configure and interact with Genie to leverage these underlying AI capabilities effectively.
Genie works by translating your natural language questions into SQL queries that run on your data. When your questions imply a need for tasks like sentiment analysis, forecasting, or complex text interpretation, Genie can be guided to generate SQL that incorporates the functionality of specific AI Functions. Your role is to provide Genie with the right context and examples so it can effectively use these powerful tools on your behalf.
To help Genie perform advanced AI tasks effectively and in alignment with your data, it’s essential to provide clear, structured configuration guidance:
Refer to this link for guidance on effectively using instructions, Example SQL, and SQL Functions within Genie.
Let's explore some core AI capabilities that Genie can provide, powered by concepts from AI Functions. Understanding these helps you craft better "Example SQL Queries" and "Instructions" for your Genie spaces.
Prerequisites for Genie to leverage these capabilities:
Capability: Genie can analyze and report on customer sentiment.
Example Natural Language Prompt to Genie: "What's the overall customer sentiment for Product P101 based on recent reviews?"
Guiding Genie: To ensure Genie accurately performs sentiment analysis on your customer_reviews table, you can provide an "Example SQL Query" in its space configuration that demonstrates the use of ai_analyze_sentiment()
To configure Genie for sentiment analysis by adding your datasets for analysis as below.
The below screenshot demonstrates the response from the Genie without the use of any AI functions. When a customer asks a question to provide the sentiment of customer reviews, the response from Genie is quite generic.
With the use of an example query, we can prompt Genie to use the query for answering questions related to analyzing sentiment on customer reviews.
The query below helps Genie respond better to the user's question, as in the screenshots below. This example teaches Genie the pattern for sentiment analysis, which it can then apply more broadly. The example query helps Genie analyse the dataset and provides the actual sentiment analysis of the data, with sentiments of positive, negative, and neutral for each product mentioned in the dataset.
-- Prompt: Example SQL Query for Genie Space: How do customer reviews trend in terms of snetiment?
-- Instructs Genie on how to perform sentiment analysis on review_text.
SELECT
product_id,
review_text,
ai_analyze_sentiment(review_text) AS sentiment
FROM
your_catalog.your_schema.customer_reviews;
When a user extends the query to inquire about the overall sentiment of a specific `product_id`, Genie will leverage the provided example to comprehend the request and formulate an appropriate response.
Capability: Genie can perform various advanced text analysis, like theme extraction or specific information retrieval.
Example Natural Language Prompt to Genie: "What are the main issues mentioned in negative reviews for Product P202?"
Guiding Genie: Provide an "Example SQL Query" to enable Genie to extract themes using the functionality of ai_query (which connects to Foundation Models).
SELECT
review_id,
review_text,
ai_query(
-- Specify preferred Foundation Model endpoint
"databricks-llama-4-maverick",
CONCAT(
"Identify the primary issue theme from this negative review (e.g., 'Quality', 'Service', 'Price'). Review: ",
review_text
)
) AS issue_theme
FROM
your_catalog.your_schema.customer_reviews
WHERE
product_id = 'P202' AND
ai_analyze_sentiment(review_text) IN ('negative', 'mixed');
This gives Genie a template for how to leverage powerful language models for your specific text analysis tasks.
To get the most out of Genie's AI capabilities:
Genie can potentially leverage the concepts behind other AI Functions like ai_classify(), ai_forecast(), ai_extract(), ai_fix_grammar(), ai_mask(), ai_summarize(), ai_translate() and many more which can be viewed on this page. You can teach Genie these patterns through "Example SQL Queries or SQL Functions" that utilize these functions.
Databricks AI/BI Genie provides an intuitive interface to your data. By understanding the concepts of AI Functions and strategically guiding Genie through clear "Instructions" and "Example SQL Queries" in its configuration, you unlock its ability to perform sophisticated AI-driven analyses. This approach allows you to leverage powerful AI capabilities through natural language, making advanced insights more accessible across your organization.
Experiment with configuring your Genie spaces with AI-powered examples to enhance their analytical depth and improve your data-driven decision-making.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.