Skip to main content

The LLM Chat component for Retool Apps

An interface for AI chat conversations.

Refer to Getting started with the LLM Chat component for more information about this component.

Properties

All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.

assistantName

The name of the AI.

Type string
Format Plain Text
Configurability Inspector
DefaultRetool AI
Examples
"Retool AI"

avatarFallback

The text that is displayed when there is no Image URL or icon.

Type string
Format Plain Text
Configurability Inspector
Defaultnull
Examples
"Jenny Appleseed"

avatarIcon

The icon that's displayed for the avatar.

Type string
Format Icon Key
Configurability Inspector
Defaultnull
Examples
"/icon:bold/user"

avatarImageSize

The size of the avatar image.

Type string
Configurability Inspector
Defaultnull

avatarSrc

The image URL to use for the avatar.

Type string
Format URL
Configurability Inspector
Defaultnull
Examples
"https://example.com/image.jpg"

data

The data.

Type string | number | boolean | object | array
Format Custom data
Configurability Inspector
Defaultnull

disableSubmit

Whether to disable form submission.

Type boolean
Configurability Inspector
Defaultnull

emptyDescription

The description to display before the first message is sent.

Type string
Configurability Inspector
Defaultnull

emptyTitle

The title to display before the first message is sent.

Type string
Configurability Inspector
Defaultnull

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Configurability Inspector > Appearance > Hidden
Defaultfalse
Examples
true

id

The unique identifier (name).

Type string
Format Plain Text
Configurability Inspector
DefaultllmChat1
Examples
query1
button1

isHiddenOnDesktop

Whether to show or hide this object in the desktop layout.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Show on desktop
Defaultfalse
Examples
true

isHiddenOnMobile

Whether to show or hide this object in the mobile layout.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Show on mobile
Defaulttrue
Examples
true

lastMessage

The last message message sent by the user.

Type string
Configurability Read-only
Defaultnull

lastResponse

The last response from the AI.

Type string
Configurability Read-only
Defaultnull

maintainSpaceWhenHidden

Whether to take up space on the canvas if hidden is true.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Maintain space when hidden
Defaultfalse
Examples
true

margin

The amount of margin to render outside.

Type string
Format Plain Text
Configurability Inspector > Spacing > Margin
Allowed Values
ValueUI OptionDescription
4px 8pxNormal

Normal margin.

0None

No margin.

Default4px 8px
Examples
4px 8px

messageHistory

A list of messages previously sent and received.

Type array
Array values string
Configurability Read-only
Defaultnull

placeholder

The text to display within the input field when there is no value.

Type string
Formatstring
Configurability Inspector > Content > Placeholder
DefaultEnter a value
Examples
Enter a value

queryTargetId

The ID of the query to send messageHistory to.

Type string
Configurability Inspector
Defaultnull

showAvatar

Whether to display an avatar.

Type boolean
Configurability Inspector
Defaultnull

showEmptyState

Whether to display an empty state before a message is sent. Enabled by adding the Empty state add-on.

Type boolean
Configurability Inspector
Defaultnull


showInEditor

Whether the component remains visible in the editor if hidden is true.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Always show in edit mode
Defaultfalse
Examples
true

showTimestamp

Whether to display a timestamp for messages.

Type array
Array values boolean
Configurability Inspector
Defaultnull

style

Custom style options.

Type object
Configurability Inspector > Appearance > style
Defaultnull

title

The title text to display.

Type string
Configurability Inspector
Defaultnull

value

The value.

Type string | number | boolean | object | array
Configurability Read-only
Defaultnull

Methods

JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

llmChat.clearHistory()

Clear the history.

Definition
llmChat.clearHistory()
Examples

Clear the history from llmChat.

llmChat.clearHistory();

llmChat.clearValue()

Clear the current values.

Definition
llmChat.clearValue()
Examples

Clear the current value of llmChat.

llmChat.clearValue();

llmChat.exportData()

Exports data as a file in a CSV, TSV, JSON, or Excel format.

Definition
llmChat.exportData(options)
Parameters

options

The options for the export.

Type object
Object Properties

data

The data.

Type string | number | boolean | object | array
Format Custom data

fileName

The file name.

Type string

fileType

The file extension.

Type string



llmChat.resetValue()

Reset the current value to the default value.

Definition
llmChat.resetValue()
Examples

Reset the current value of llmChat.

llmChat.resetValue();

llmChat.scrollIntoView()

Scrolls the canvas or parent container so that the selected component appears in the visible area.

Definition
llmChat.scrollIntoView(options)
Parameters

options

The scroll options.

Type object
Object Properties

behavior

The scroll behavior.

Type string
Allowed Values
ValueDescription
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.


block

The scroll position relative to the component.

Type string
Allowed Values
ValueDescription
nearest

Scrolls only the minimum amount required for the component to appear in the visible area. Scrolling does not occur if the component is already in view.

start

Scrolls to position the component at the top of the visible area.

center

Scrolls to position the component in the middle of the visible area.

end

Scrolls to position the component at the bottom of the visible area.



Examples

Scroll the minimum amount to immediately bring llmChat into view.

llmChat.scrollIntoView({behavior: 'auto', block: 'nearest'});

llmChat.sendMessage()

Send the current message.

Definition
llmChat.sendMessage()

llmChat.setHidden()

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

Definition
llmChat.setHidden(hidden)
Parameters

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide llmChat.

llmChat.setHidden(true);

Unhide llmChat.

llmChat.setHidden(false);

llmChat.setShowHeader()

Set the showHeader value to toggle whether the component header is visible.

Definition
llmChat.setShowHeader(showHeader)
Parameters

showHeader

Whether to show the header area.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Show the header of llmChat.

llmChat.setShowHeader(true);

Hide the header of llmChat.

llmChat.setShowHeader(false);

llmChat.setValue()

Set the current value.

Definition
llmChat.setValue(key, value)
Parameters

key

The key.

Type string

value

The value.

Type string | number | boolean | object | array

Examples

Set the current value of llmChat to userValue.

llmChat.setValue(userValue);

Events

Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.

EventDescription