Retool AI text actions
Learn how to generate and analyze text with Retool AI.
You can use the Retool AI resource to write queries that leverage AI models to generate and analyze text content. You can provide text directly in the query, reference existing data from elsewhere (e.g., another query), or use data stored in Retool Vectors.
As with all queries, the response is available at {{ query.data }}
. If you reference the query data in a component, such as a Text Area component, Retool streams the response so it appears in real time.
To get started with Text actions for apps, add a new AI Action query. For workflows, add a new AI Action block.
- Web and mobile apps
- Workflows
Generate text
Use the Generate text action to generate text content based on the instructions you provide.
- Select the Generate text action.
- Enter some instructions in the Input field.
- Select the AI model to use, (e.g., GPT-4).
- Click Save and then Run to perform the action.
The specified AI model then generates the requested text.
Include context from Retool Vectors
You can include related information from Retool Vectors to provide more context. This allows you to instruct AI models to use your own data when making decisions, such as responding to a customer with context from support articles.
If you are not yet using Retool Vectors, follow the quickstart to get started.
To include context from a specific Vector, check Use Retool Vectors to provide more context to your query. You can then select a vector to reference. When enabled, Retool identifies relevant content and includes it in the request.
Summarize text
Use the Summarize text action to generate a summary of the provided text.
- Select the Summarize text action.
- Enter a passage of text in the Input field.
- Select the AI model to use, (e.g., GPT-4).
Click Save and then Run to perform the action. The specified AI model then generates a summary of the provided text.
Classify text
Use the Classify text action to analyze text and categorize it with one of the specified labels. The AI model determines what each label should be for and decides which label most appropriately reflects the text. This is useful for performing customer support or sentiment analysis.
- Select the Classify text action.
- Enter a passage of text in the Input field.
- Specify the Classification labels with which to use.
- Select the AI model to use, (e.g., GPT-4).
{{ query.data }}
contains a category
property with a value that corresponds to the chosen label.
Extract entity from text
The Extract entity from text action analyzes the input text and identifies information based on the specified entities.
- Select the Extract entity from text action.
- Enter a passage of text in the Input field.
- Specify the Entities to extract (e.g.,
product name
oraddress
). - Select the AI model to use, (e.g., GPT-4).
{{ query.data }}
contains an array of key-value pairs for each entity the AI model has identified.