Conversations are the next generation in natural language queries

Marty Gubar
Oracle Developers
Published in
3 min readApr 1, 2024

Autonomous Database Select AI has just introduced a powerful new capability that lets you have conversations with your data. What’s the difference between a natural language query and a conversation? A lot!

Conversations provide a natural way to analyze your data. Ask a question, review the result, and then follow up with questions to clarify or seek more information. It’s simple because we all have been doing this since we learned to speak.

Let’s look at an example. Below we started with a top-level question asked by an analyst for a movie streaming service. The analyst then followed up with additional questions:

  • “What are our total streams?”
  • “Break that out by genre”
  • “Add customer segment”
  • “Keep the top 5 customer segments and genres by total views. Include a rank in the result”

It’s a typical conversation you may have with a colleague (although perhaps a little bossy 😉). You can see in the demo below how Select AI lets you have this same conversation with your data, with help from an LLM that interprets the conversational thread and generates SQL:

Notice that Select AI now supports a new kind of SQL:

SELECT AI
Start with our total streams

The “SELECT” keyword will look familiar to those who know SQL. After that, everything changes. SQL in Autonomous Database has been enhanced with a new “AI” keyword. This indicates that the subsequent text will be natural language. You don’t need to worry about where the data resides or how to formulate the query. Just ask a question. Your natural language will be translated into Oracle SQL using an LLM. You can learn more about the Select AI syntax in the Autonomous Database speaks “human” post and Chat with Your Data in Autonomous Database Using Generative AI LiveLab.

And at the end of the demo, it asks Select AI to explain the generated query — both the SQL code and what the code means. With all the back and forth in the conversation, this explanation can be really helpful when confirming the results.

How to enable conversations

You enable conversations in your Select AI profile. The Select AI profile captures information about your AI provider, the LLM used to translate natural language into queries, the source tables to use for the queries, and more. For conversations, you need to use an OpenAI GPT model (from Azure or directly from OpenAI). In the profile, simply set the conversations flag to “true” to enable the capability:

BEGIN
DBMS_CLOUD_AI.CREATE_PROFILE (
profile_name => 'your_profile',
attributes =>
'{"provider": "azure",
"azure_resource_name": "your-resource",
"azure_deployment_name": "your-deployment",
"credential_name": "AI_CREDENTIAL",
"comments":"true",
"conversation": "true",
"object_list": [
{"owner": "moviestream", "name": "GENRE"},
{"owner": "moviestream", "name": "CUSTOMER"},
{"owner": "moviestream", "name": "PIZZA_SHOP"},
{"owner": "moviestream", "name": "STREAMS"},
{"owner": "moviestream", "name": "MOVIES"},
{"owner": "moviestream", "name": "ACTORS"}
]
}'
);
END;
/

Then, enable the profile for your session:

BEGIN
DBMS_CLOUD_AI.SET_PROFILE (
profile_name => 'your_profile'
);
END;
/

That’s it! Start having conversations with your data.

Summary

Conversations are a real breakthrough for natural language queries. They let you explore your data in any direction in the most natural way possible. You can get started using conversations today. If you’re using Autonomous Database — it’s already deployed. Or spin up an Autonomous Database Always Free instance and give it a try. Don’t forget to go to the Autonomous Database Getting Started page to find webcasts, tutorials, demos, and more.

--

--

Oracle Developers
Oracle Developers

Published in Oracle Developers

Aggregation of articles from Oracle engineers, Groundbreaker Ambassadors, Oracle ACEs, and Java Champions on all things Oracle technology. The views expressed are those of the authors and not necessarily of Oracle.

Marty Gubar
Marty Gubar

Written by Marty Gubar

I'm a product manager for Autonomous Database. I've been doing data analytics for years, from little OLAP engines to big data. Love to hike my dogs every day.