AIMessageParts

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.

AIMessageParts(parts = parts)

Each step shows through AIMessagePartItem: reasoning, tool calls, and a neutral placeholder for kinds this SDK doesn't know. With an AIToolApprover, a call waiting for this person's approval shows its question under it, and with its AIToolAuthorizer, a call waiting for them to sign in shows the sign-in, through ChatAiComponentFactory.AIToolAuthorizationContent. To show some steps your own way, such as reasoning you stream separately or a kind of your own, use the overload that takes content and fall back to AIMessagePartItem for the rest.

Parameters

parts

The reply's steps, from AIMessagePart.parts.

modifier

The modifier to apply to the list.

approver

Who answers calls' questions on this device, to ask them.

textStyle

The style of the steps.

reasoningColors

The palette of reasoning steps.

toolCallColors

The palette of tool calls and of the placeholder for unknown steps.

toolApprovalColors

The palette of calls' questions and sign-ins.


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.

AIMessageParts(parts = parts) { part ->
val reasoning = part.reasoning
if (reasoning != null) {
StreamingReasoning(part = reasoning, text = liveText[reasoning.id])
} else {
AIMessagePartItem(part = part)
}
}

Parameters

parts

The reply's steps, from AIMessagePart.parts.

modifier

The modifier to apply to the list.

content

Shows one step. Steps are keyed by their ID, so a step keeps its state as the reply updates.