ChatBackend

fun interface ChatBackend(source)

Produces one assistant turn as a cold stream of ChatEvents.

The flow is collected by ChatController; cancelling the collection (the user pressed stop) must cancel the underlying request. Failures are reported by throwing — the controller turns them into dev.ai.elements.core.model.ChatStatus.ERROR.

The history is the whole conversation so far, ending with the new user message.

Functions

Link copied to clipboard
abstract fun stream(history: List<Message>): Flow<ChatEvent>