Skip to main content

Retool AI chat actions

Learn how to generate chat responses with Retool AI.

You can use the Retool AI resource to generate chat responses based on the provided instructions and message history. You can provide text directly in the query, reference existing data from elsewhere (e.g., another query), or use data stored in Retool Vectors.

Get started

To get started with chat actions for apps, add a new LLM Chat component. For workflows, add a new AI Action block.

Adding a LLM Chat component automatically creates an AI Action query with Generate chat response selected and prefills the input and message history.

  1. Add an LLM Chat component to the canvas.
  2. Find the newly-created Retool AI query.
  3. Optionally, enable Use Retool Vectors to provide more context to your query, and choose the vector you want to use. Incorporating Vectors enables the chatbot to generate responses specific to your needs.
  4. Select the AI model to use (e.g., GPT-4).
  5. Click Save and then Run to perform the action.

The specified AI model then generates a response based on the previous messages and additional input provided.

Like all components, you can access LLM Chat component properties using JavaScript. For example, LLM Chat components have a messageHistory property that contains all messages in the chat log. You can reference specific messages using {{ chat1.messageHistory[0].content }}.

Refer to the LLM Chat guide for more information about this component.