Package-level declarations

Types

Link copied to clipboard
data class AIConversationAssistantMessageParams(val message: AIMessage, val text: String, val isGenerating: Boolean, val parts: List<AIMessagePart>, val attachments: List<AIMessageAttachment>, val reasoningText: (AIReasoningPart) -> String?, val approver: AIToolApprover?, val modifier: Modifier = Modifier)
Link copied to clipboard
data class AIConversationAttachmentParams(val attachment: AIMessageAttachment, val role: AIMessageRole, val modifier: Modifier = Modifier)
Link copied to clipboard
data class AIConversationColors(val scrollButtonBackground: Color, val scrollButtonBorder: Color, val scrollButtonIcon: Color, val loadingIndicator: Color)

The palette of AIConversation's own views.

Link copied to clipboard
Link copied to clipboard
data class AIConversationIcons(val scrollToLatest: Painter)

The icons of AIConversation's own views.

Link copied to clipboard
data class AIConversationReplyActionsParams(val message: AIMessage, val text: String, val isLatestReply: Boolean, val modifier: Modifier = Modifier)
Link copied to clipboard
data class AIConversationUserMessageParams(val message: AIMessage?, val text: String, val attachments: List<AIMessageAttachment>, val modifier: Modifier = Modifier)
Link copied to clipboard
data class AIMessageAttachmentColors(val imagePlaceholder: Color, val background: Color, val border: Color, val iconBackground: Color, val icon: Color, val name: Color, val details: Color)

The palette of AIMessageAttachmentItem.

Link copied to clipboard
data class AIMessageAttachmentIcons(val file: Painter, val pdf: Painter, val image: Painter, val audio: Painter, val video: Painter, val archive: Painter)

The icons of AIMessageAttachmentItem, one for each type of file. A file's type comes from its media type, else from the extension of its name or URI.

Link copied to clipboard
data class AIReplyActionsColors(val icon: Color)

The palette of AIReplyActionsRow.

Link copied to clipboard
Link copied to clipboard
data class AIReplyActionsIcons(val copy: Painter, val copied: Painter, val share: Painter, val regenerate: Painter, val ratePositive: Painter, val ratedPositive: Painter, val rateNegative: Painter, val ratedNegative: Painter)

The icons of AIReplyActionsRow.

Link copied to clipboard
data class AISuggestionsChipParams(val text: String, val onClick: () -> Unit)
Link copied to clipboard
data class AIToolApprovalColors(val title: Color, val message: Color, val background: Color, val border: Color, val accent: Color, val failure: Color)

The palette of AIToolApprovalCard.

Link copied to clipboard
Link copied to clipboard
data class AIToolApprovalState(val isSending: Boolean = false, val failed: Boolean = false)

Where the person's answer to a question is.

Link copied to clipboard
class AIToolApprover(val userId: String, val clientId: String, scope: CoroutineScope, val authorizer: AIToolAuthorizer? = null, decide: suspend (call: AIToolCallPart, allowed: Boolean) -> Unit)

The person answering tool calls' questions and sign-ins on this device, and how their answer reaches your backend, which holds each call until it gets one.

Link copied to clipboard
data class AIToolAuthorizationContentParams(val call: AIToolCallPart, val authorization: AIToolAuthorization, val state: AIToolAuthorizationState, val connect: () -> Unit, val decline: () -> Unit, val textStyle: TextStyle, val colors: AIToolApprovalColors, val modifier: Modifier = Modifier)
Link copied to clipboard
data class AIToolAuthorizationState(val isConnecting: Boolean = false, val isDeclining: Boolean = false, val connectFailed: Boolean = false, val declineFailed: Boolean = false, val isExpired: Boolean = false)

Where the person's sign-in is.

Link copied to clipboard
class AIToolAuthorizer(connect: suspend (call: AIToolCallPart, url: String) -> Boolean, decline: suspend (call: AIToolCallPart) -> Unit)

How the person signs in on this device when a tool call waits for their account at a provider, and how their "not now" reaches your backend, which holds the call until one or the other.

Link copied to clipboard
data class AIToolCallColors(val title: Color, val detail: Color, val accent: Color, val success: Color, val failure: Color)

The palette of AIToolCall.

Link copied to clipboard

Defaults of AIToolCall.

Link copied to clipboard
Link copied to clipboard
data class AITypingIndicatorLabelParams(val modifier: Modifier = Modifier)
Link copied to clipboard
data class AIUserMessageColors(val background: Color, val text: Color)

The palette of AIUserMessage.

Link copied to clipboard
Link copied to clipboard

What a voice agent is doing, which a voice visualization shows as motion.

Link copied to clipboard

How AIVoiceGlow is drawn. Either way it moves the same; only the look and the cost differ.

Link copied to clipboard

Defaults for the voice visualizations.

Link copied to clipboard

Factory that creates the components rendered inside the AI chat UI.

Link copied to clipboard
data class ComposerInputContentParams(val messageData: MessageData, val isGenerating: Boolean, val onTextChange: (String) -> Unit, val onRemoveAttachment: (Uri) -> Unit, val onSendClick: () -> Unit, val onStopClick: () -> Unit, val focusRequester: FocusRequester? = null)
Link copied to clipboard
data class ComposerInputTrailingContentParams(val text: String, val isGenerating: Boolean, val speechToTextState: SpeechToTextButtonState, val onPermissionDenied: () -> Unit)
Link copied to clipboard
data class ComposerLeadingContentParams(val isGenerating: Boolean, val onAttachmentsClick: () -> Unit)
Link copied to clipboard
Link copied to clipboard
data class MessageData(val text: String = "", val attachments: Set<Uri> = emptySet())

Data class representing a message composed by the user.

Link copied to clipboard

State holder for SpeechToTextButton that tracks the recording status.

Link copied to clipboard
data class StreamingReasoningColors(val title: Color, val text: Color, val footnote: Color, val shimmer: Color, val rule: Color)

The palette of StreamingReasoning.

Link copied to clipboard

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun AIAssistantMessage(text: String, modifier: Modifier = Modifier, isGenerating: Boolean = false, parts: List<AIMessagePart> = emptyList(), attachments: List<AIMessageAttachment> = emptyList(), approver: AIToolApprover? = null, reasoningText: (AIReasoningPart) -> String? = { null })

A reply from the agent: the steps it took, then its answer, written out as it arrives, and then its attachments, across the whole width.

Link copied to clipboard
fun AIConversation(messages: List<AIMessage>, modifier: Modifier = Modifier, pendingMessage: AIPendingMessage? = null, isThinking: Boolean = false, approver: AIToolApprover? = null, loadOlderMessages: suspend () -> Unit? = null, footer: @Composable () -> Unit = {}, emptyContent: @Composable () -> Unit = {}, colors: AIConversationColors = AIConversationDefaults.colors(), icons: AIConversationIcons = AIConversationDefaults.icons(), contentPadding: PaddingValues = PaddingValues())

Shows AIMessages with the views of LocalChatAiComponentFactory: each message the person sent with ChatAiComponentFactory.AIConversationUserMessage, each reply with ChatAiComponentFactory.AIConversationAssistantMessage, and under a finished reply, once its answer is written out, ChatAiComponentFactory.AIConversationReplyActions.

fun <T> AIConversation(messages: List<T>, key: (T) -> Any, isFromUser: (T) -> Boolean, modifier: Modifier = Modifier, isThinking: Boolean = false, loadOlderMessages: suspend () -> Unit? = null, footer: @Composable () -> Unit = {}, emptyContent: @Composable () -> Unit = {}, colors: AIConversationColors = AIConversationDefaults.colors(), icons: AIConversationIcons = AIConversationDefaults.icons(), contentPadding: PaddingValues = PaddingValues(), messageContent: @Composable (T) -> Unit)

The messages of a conversation with an AI agent, oldest first, shown your own way.

Link copied to clipboard
fun AIMessageAttachmentItem(attachment: AIMessageAttachment, modifier: Modifier = Modifier, imageSize: Dp = 180.dp, nameTextStyle: TextStyle = MaterialTheme.typography.labelLarge, detailsTextStyle: TextStyle = MaterialTheme.typography.bodySmall, colors: AIMessageAttachmentColors = AIMessageAttachmentDefaults.colors(), icons: AIMessageAttachmentIcons = AIMessageAttachmentDefaults.icons())

One of a message's attachments: an image as a square thumbnail, and any other kind as a file, with its name, type and size, that opens when tapped.

Link copied to clipboard
fun AIMessagePartItem(part: AIMessagePart, modifier: Modifier = Modifier, approver: AIToolApprover? = null, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, reasoningColors: StreamingReasoningColors = StreamingReasoningDefaults.colors(), toolCallColors: AIToolCallColors = AIToolCallDefaults.colors(), toolApprovalColors: AIToolApprovalColors = AIToolApprovalDefaults.colors())

One step of a reply: a round of reasoning with its preview, a tool call (with its question or its sign-in, when it waits for the approver), or a neutral placeholder for a step this SDK doesn't know. The sign-in shows through ChatAiComponentFactory.AIToolAuthorizationContent.

Link copied to clipboard
fun AIMessageParts(parts: List<AIMessagePart>, modifier: Modifier = Modifier, content: @Composable (part: AIMessagePart) -> Unit)

The steps an AI agent took while replying, in order, each shown by content.

fun AIMessageParts(parts: List<AIMessagePart>, modifier: Modifier = Modifier, approver: AIToolApprover? = null, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, reasoningColors: StreamingReasoningColors = StreamingReasoningDefaults.colors(), toolCallColors: AIToolCallColors = AIToolCallDefaults.colors(), toolApprovalColors: AIToolApprovalColors = AIToolApprovalDefaults.colors())

The steps an AI agent took while replying, in order. Show it before the reply's text.

Link copied to clipboard
fun AIReplyActionsRow(text: String, actions: AIReplyActions, modifier: Modifier = Modifier, colors: AIReplyActionsColors = AIReplyActionsDefaults.colors(), icons: AIReplyActionsIcons = AIReplyActionsDefaults.icons())

The buttons under a finished reply: copy and share, then regenerate and rate when the app handles them.

Link copied to clipboard
fun AISuggestions(suggestions: List<String>, onSuggestionClick: (String) -> Unit, modifier: Modifier = Modifier, itemMaxWidth: Dp = 160.dp, contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp, vertical = 8.dp))

A horizontally scrolling row of suggestion chips, usually placed above ChatComposer on a new chat.

Link copied to clipboard
fun AIThinking(modifier: Modifier = Modifier)

A reply's thinking before any of it arrives: "Thinking…", counting the seconds.

Link copied to clipboard
fun AIToolApprovalCard(approval: AIToolApproval, state: AIToolApprovalState, decide: (allowed: Boolean) -> Unit, modifier: Modifier = Modifier, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: AIToolApprovalColors = AIToolApprovalDefaults.colors())

A tool call's question: what it asks, the agent's reason and what allowing it shares, and buttons to allow or decline it.

Link copied to clipboard
fun AIToolApprovalPrompt(call: AIToolCallPart, approver: AIToolApprover, modifier: Modifier = Modifier, content: @Composable (approval: AIToolApproval, state: AIToolApprovalState, decide: (allowed: Boolean) -> Unit) -> Unit = { approval, state, decide -> AIToolApprovalCard(approval = approval, state = state, decide = decide) })

Asks the person a tool call waits for whether it may run: the question its ai_tool_call step carries (status awaiting_approval, with approval). It shows only to that person, on the device the call names, and only while the call waits, so it can sit under every tool call:

Link copied to clipboard
fun AIToolAuthorizationCard(authorization: AIToolAuthorization, state: AIToolAuthorizationState, connect: () -> Unit, decline: () -> Unit, modifier: Modifier = Modifier, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: AIToolApprovalColors = AIToolApprovalDefaults.colors())

A tool call's sign-in: which provider it needs and what signing in means, with buttons to connect or to say not now.

Link copied to clipboard
fun AIToolAuthorizationPrompt(call: AIToolCallPart, approver: AIToolApprover, modifier: Modifier = Modifier, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: AIToolApprovalColors = AIToolApprovalDefaults.colors(), content: @Composable (authorization: AIToolAuthorization, state: AIToolAuthorizationState, connect: () -> Unit, decline: () -> Unit) -> Unit = { authorization, state, connect, decline -> with(LocalChatAiComponentFactory.current) { AIToolAuthorizationContent( AIToolAuthorizationContentParams( call = call, authorization = authorization, state = state, connect = connect, decline = decline, textStyle = textStyle, colors = colors, ), ) } })

Asks the person a tool call waits for to sign in at the provider it needs: the sign-in its ai_tool_call step carries (status awaiting_authorization, with authorization). Connect hands the sign-in page to the approver's AIToolAuthorizer, which opens it. Once the provider has answered, your backend updates the step and the call goes on. It shows only to that person, only while the call waits, and only with an AIToolAuthorizer, so it can sit under every tool call. Once the sign-in's AIToolAuthorization.expiresAt passes, it says so and stops offering Connect:

Link copied to clipboard
fun AIToolCall(part: AIToolCallPart, modifier: Modifier = Modifier, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: AIToolCallColors = AIToolCallDefaults.colors())

One tool call: what it is doing, where it runs, and how it went.

Link copied to clipboard
fun AITypingIndicator(modifier: Modifier = Modifier, label: @Composable () -> Unit = { with(LocalChatAiComponentFactory.current) { AITypingIndicatorLabel(AITypingIndicatorLabelParams()) } }, indicator: @Composable () -> Unit = { with(LocalChatAiComponentFactory.current) { AITypingIndicatorIndicator(AITypingIndicatorIndicatorParams()) } })

A typing indicator composable that displays an optional label and an animated indicator.

Link copied to clipboard
fun AIUserMessage(text: String, modifier: Modifier = Modifier, attachments: List<AIMessageAttachment> = emptyList(), onEdit: () -> Unit? = null, textStyle: TextStyle = MaterialTheme.typography.bodyLarge, colors: AIUserMessageColors = AIUserMessageDefaults.colors())

A message the person sent: its attachments, then its text in a bubble, at the end of the row. Pressing and holding the bubble offers to copy the text, and to edit it given onEdit.

Link copied to clipboard
fun AIVoiceGlow(state: AIVoiceAgentState, modifier: Modifier = Modifier, colors: List<Color> = AIVoiceVisualizationDefaults.colors(), expressivity: Float = 1.0f, audioLevel: () -> Float?? = null, rendering: AIVoiceGlowRendering = AIVoiceGlowRendering.Auto)

A voice agent as a soft, airy globe: color masses orbit inside it and swell with speech, and the gaps between them let the background show through. Tapping the globe bounces it; drawn with the shader, it also ripples from the touch and under a hovering mouse or stylus.

Link copied to clipboard
fun AIVoiceWave(state: AIVoiceAgentState, modifier: Modifier = Modifier, colors: List<Color> = AIVoiceVisualizationDefaults.colors(), expressivity: Float = 1.0f, audioLevel: () -> Float?? = null)

A voice agent as a single string, flat at its ends, carrying a wave packet that erupts with speech while its colors flow along it. Tapping the string ripples it from the touch, and so does a hovering mouse or stylus.

Link copied to clipboard
fun ChatComposer(onSendClick: (data: MessageData) -> Unit, onStopClick: () -> Unit, isGenerating: Boolean, modifier: Modifier = Modifier, messageData: MessageData = MessageData(), focusRequester: FocusRequester? = null)

Chat composer with attach, voice, and send buttons.

fun ChatComposer(messageData: MessageData, onMessageDataChange: (MessageData) -> Unit, onSendClick: (data: MessageData) -> Unit, onStopClick: () -> Unit, isGenerating: Boolean, modifier: Modifier = Modifier, focusRequester: FocusRequester? = null)

Chat composer with attach, voice, and send buttons, whose message the caller owns.

Link copied to clipboard

Builds a compound ChatAiComponentFactory by wrapping the current factory and provides it to content through LocalChatAiComponentFactory.

Link copied to clipboard
fun rememberSpeechToTextButtonState(onPartialResult: (String) -> Unit? = null, onFinalResult: (String) -> Unit): SpeechToTextButtonState

Creates and remembers a SpeechToTextButtonState instance.

Link copied to clipboard
fun SpeechToTextButton(state: SpeechToTextButtonState, modifier: Modifier = Modifier, onPermissionDenied: () -> Unit = { }, idleContent: @Composable (onClick: () -> Unit) -> Unit = { onClick -> with(LocalChatAiComponentFactory.current) { SpeechToTextButtonIdleContent(SpeechToTextButtonIdleContentParams(onClick = onClick)) } }, recordingContent: @Composable (onClick: () -> Unit, rmsdB: Float) -> Unit = { onClick, rmsdB -> with(LocalChatAiComponentFactory.current) { SpeechToTextButtonRecordingContent( SpeechToTextButtonRecordingContentParams(onClick = onClick, rmsdB = rmsdB), ) } })

A composable button that provides speech-to-text functionality.

Link copied to clipboard
fun StreamingReasoning(part: AIReasoningPart, modifier: Modifier = Modifier, text: String? = null, footnote: String? = null, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: StreamingReasoningColors = StreamingReasoningDefaults.colors())

Shows a reasoning step: its live text when the app has it, otherwise the step's preview, with its summary beside "Thought for 12s" once it is done.

fun StreamingReasoning(text: String, isThinking: Boolean, modifier: Modifier = Modifier, durationSeconds: Double? = null, summary: String? = null, footnote: String? = null, initiallyExpanded: Boolean = false, showsLiveReasoning: Boolean = true, maxExpandedHeight: Dp = 260.dp, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: StreamingReasoningColors = StreamingReasoningDefaults.colors())

A model's reasoning (its "thinking"), shown alongside its reply.

Link copied to clipboard
fun StreamingText(text: String, animate: Boolean = true, chunkDelayMs: Long = 30, content: @Composable (displayedText: String) -> Unit = { displayedText -> RichText(text = displayedText) })

A composable that wraps content and provides streaming animation. Progressively reveals text content word-by-word and whitespace chunk-by-chunk.