AIUIComponent

A view of the app's that the agent can place in a reply's generated UI: its description, and how it looks for the arguments the agent wrote.

Every format places it by name, so one component works whichever format the agent writes. Its arguments are the JSON the agent wrote, as plain Kotlin values: read what you need and show nothing while they don't fit, such as while they are still streaming in. A component can load data of its own, such as the person's calendar, which then never reaches the agent.

val placeCard = AIUIComponent(
AIUIComponentDefinition(
name = "place_card",
description = "A photo and a short summary of a place.",
parameters = listOf(AIUIParameter.required("title", AIUIParameterType.String)),
events = listOf(AIUIComponentDefinition.Event("ask_about", "The person asks about the place.")),
),
) { arguments, context ->
val title = arguments["title"] as? String ?: return@AIUIComponent
PlaceCard(title = title, onClick = { context.emit("ask_about", label = "Tell me more about $title") })
}

Properties

Link copied to clipboard

Its description, the same on every platform and for the agent.

Link copied to clipboard
open val name: String

The name the agent places it by.

Functions

Link copied to clipboard
abstract fun Content(arguments: Map<String, Any?>, context: AIUIComponentContext)

How it looks for the arguments the agent wrote. It tells the agent what the person does in it through context. Renderers bring it in as it shows, with AIUIEntrance.