Leverage AI in workflows
Learn how to integrate AI features using Smart blocks in Retool Workflows.
Any data you pass to a Smart block is sent to and processed by OpenAI. If you do not use the Smart block, no data is sent to OpenAI. Smart blocks are available on Retool Cloud only.
Smart blocks provide built-in support for Open AI's GPT models. You can write instructions and select the model to use, with results returned back to the workflow. You can include workflow data using {{ }}
within the block.
Add a Smart block
To interact with AI in a workflow, add a Smart block to the canvas.
Interact with GPT models
OpenAI limits how much data can be processed by each model. These limits vary depending on complexity. As a general rule, avoid Smart block queries that exceed 3,000 words for
text-davinci-003
andgpt-3.5-turbo
, and 6,000 words forgpt-4
. The Smart block returns an error if the query exceeds any limits.
You can write instructions and send data to OpenAPI from the workflow. This enables you to build AI-powered workflows that can perform sentiment analysis, categorization, summarization, and more. For example, ChatGPT can take a list of countries and identify which continent they are in, then return the results.
Data: {{ query2.data }}
Instruction: What continent is each country in?
{
"data": "Vatican City: Europe\nTurkey: Asia\nArgentina: South America\nSpain: Europe\nItaly: Europe\nGreece: Europe\nChina: Asia\nRussia: Europe/Asia\nCzech Republic: Europe\nChile: South America\nUSA: North America\nFrance: Europe\nUnited Kingdom: Europe\nNetherlands: Europe\nMalaysia: Asia\nGermany: Europe\nJapan: Asia\nCanada: North America\nThailand: Asia",
"metadata": null
}
While ChatGPT can be highly effective, AI-generated results can be inaccurate. You should review all responses to ensure they are accurate.
Updated 5 days ago