Write queries using AI

Learn how to write queries using Retool's AI features.

🎉

beta

Retool’s AI features are in public beta for Retool Cloud organizations. A Retool admin can enable AI-powered features in the organization's Beta settings. By opting into the AI features beta for your organization in Retool, you acknowledge that your organization will be opted into future AI beta features.

Retool’s AI capabilities use OpenAI’s GPT model to help you write and edit SQL queries using natural language. When enabled, you can access them in the Query Library and App editor when editing any SQL query. Click the AI icon in the bottom right corner, or use the keyboard shortcut Alt Ctrl . to get started.

Generate queries

Retool’s AI operates in three modes: generate, edit, and explain. When your query is empty, the AI operates in generate mode and can write you a query using plain English.

Click Ask AI to open a text field and make your request.

Using AI to generate a query

Edit queries

If you have a query already, Retool’s AI operates in edit mode and can modify the existing query. Click the Ask AI icon to open a text field and make your request.

Using AI to edit a query

Explain queries

For existing queries, you can also set Retool’s AI to operate in explain mode, which describes the functionality of the existing query by adding a comment.

Click the Ask AI icon and select Edit > Explain to add a comment to the query.

Using AI to explain a query

Data sharing and AI output

This SQL feature does not share your table contents, such as the results of any query you run with AI partners. It does share metadata, like your database schema, with OpenAI so that GPT can more effectively help you write queries. If you have sensitive data you do not want to share as part of your metadata, you should not use Retool’s AI features.

Also note that as with other experimental AI features, Retool cannot guarantee that the output is always accurate. It's ultimately your responsibility to evaluate a query before running it.

If you have feedback or questions about Retool's AI features, contact [email protected].