Skip to main content
The ChatSettings class is designed to create and send a dynamic form to the UI. This form can be updated by the user.

Attributes

inputs
List[InputWidget]
The fields of the form. Mutually exclusive with tabs — use one or the other.
tabs
List[Tab]
Group inputs into named tabs. Each Tab has an id, a label, and its own list of inputs. Mutually exclusive with the top-level inputs list.

Methods

send()

Sends the settings form to the UI and commits the current values into the session (session.chat_settings). Use this when initializing settings or when you want to update both the UI and the committed session state.

refresh()

Pushes the settings form to the UI without updating the committed session settings. This is useful inside @cl.on_settings_edit when you want to dynamically update the available widgets (e.g., show/hide fields based on a selection) without treating the edit as a confirmed change.
Since version 2.11.0.

Usage

You can also access the Chainlit chat settings using a combination of the @ and / commands. Using @, you can trigger the chat settings Select input, and using /, you can choose the selected setting’s input values.

Single Select option Type

The user selecting a command

Multi Select option Type

The user selecting a command

Dynamic Widget Refresh

Use refresh() inside @cl.on_settings_edit to update the form dynamically as the user edits, without committing changes to the session. The committed session settings only change when the user confirms (triggers @cl.on_settings_update).
Since version 2.11.0.

Tabs

Use Tab to group settings into named tabs when you have many inputs across distinct categories.
Since version 2.9.1.