Skip to main content

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.

Generate text

Use the Generate text action to generate text content based on the instructions you provide.

  1. Select the Generate text action.
  2. Enter some instructions in the Input field.
  3. Select the AI model to use, (e.g., GPT-4).
  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.

Get started with Retool Vectors

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.

  1. Select the Summarize text action.
  2. Enter a passage of text in the Input field.
  3. 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.

  1. Select the Classify text action.
  2. Enter a passage of text in the Input field.
  3. Specify the Classification labels with which to use.
  4. 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.

  1. Select the Extract entity from text action.
  2. Enter a passage of text in the Input field.
  3. Specify the Entities to extract (e.g., product name or address).
  4. 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.