Skip to content
Types
import type { Interrupt, AssistantMessage, ChatMessage, ChatMessageBase, UserMessage } from "@arcgis/ai-components/components/arcgis-assistant/types.js";

Type definitions

Interrupt

Type definition

An interrupt is a UI mechanism used by an agent to prompt the user for additional input or clarification.

id

Property
Type
string | undefined

The unique identifier of the message associated with the interrupt. This is used to associate the interrupt with specific messages.

type

Property
Type
"boolean-choice" | "multi-select" | "single-select" | "text-input"

The type of interrupt, which determines how the assistant will prompt the user for input. The available types are:

  • boolean-choice: Presents the user with a yes/no question.
  • multi-select: Allows the user to select multiple options from a list using a checkbox interface.
  • single-select: Allows the user to select a single option from a list using a radio button interface.
  • text-input: Prompts the user to enter free-form text input.

The assistant will use the specified type to determine how to display the prompt and collect the user's response. For example, a boolean-choice interrupt might be used to confirm an action, while a text-input interrupt could be used to ask for more details about a request.

message

Property
Type
string | undefined

The message to display to the user when prompting for input. This should provide clear instructions or questions related to the interrupt, guiding the user on what information is needed or what action they should take in response to the prompt.

For example, if the interrupt type is boolean-choice, the message might be "Do you want to proceed with this action?" If the type is text-input, the message could be "Please provide more details about your request."

options

Property
Type
string[] | undefined

The options to present to the user for selection when the interrupt type is multi-select or single-select. This should be an array of strings representing the available choices. For boolean-choice, the options are implicitly "Yes" and "No" and do not need to be provided. For text-input, options are not applicable and should be omitted.

For example, if the interrupt type is multi-select, the options might be ["Option 1", "Option 2", "Option 3"]. If the type is single-select, the options could be ["Choice A", "Choice B", "Choice C"].

AssistantMessage

Type definition

A chat message sent by the assistant.

Supertypes
ChatMessageBase

role

Property
Type
"assistant"

content

Property
Type
string | undefined

The content of the assistant's message. This can include text generated by the assistant in response to the user's message. The content is displayed in the chat interface for the user to read and interact with.

log

Property
Type
string[] | undefined

Log messages related to the assistant's processing of the user's request. This can include information about the agents or tools it invoked, the parameters generated by the LLM, and any relevant details about how it arrived at its response. Log messages are primarily intended for debugging and transparency purposes, allowing developers and users to understand the assistant's behavior and decision-making process.

error

Property
Type
string | undefined

An error message indicating any issues that occurred while the assistant was processing the user's request. The error message may be displayed in the chat interface to inform the user of the issue and can also be used for debugging and improving the assistant's performance.

feedback

Property
Type
Feedback | undefined

Feedback provided by the user for this specific assistant message. This allows users to indicate whether the assistant's response was helpful or not, which the app developer can capture and use to improve the assistant's performance over time.

ChatMessage

Type definition

A chat message from the user or the assistant. Messages include all relevant information such as content, logs, errors, and feedback.

ChatMessageBase

Type definition

The base interface for chat messages exchanged between the user and the assistant.

id

Property
Type
string

The unique identifier for the message. This is used to associate messages with interrupts and feedback. If not provided, a unique ID will be generated automatically.

UserMessage

Type definition

A chat message sent by the user.

Supertypes
ChatMessageBase

role

Property
Type
"user"

content

Property
Type
string

The content of the user's message. This is the text input provided by the user in the chat interface. This content is sent to the assistant and its agents for processing and generating responses.

Feedback

Type definition

Feedback provided by the user for a specific message.

positive

Property
Type
boolean

Indicates whether the feedback is positive or negative.