UiMessageStreams

Since

0.3.0-beta01

Functions

Link copied to clipboard
fun getResponseUiMessageId(messages: List<UIMessage>, createId: () -> String = { "msg_${messages.size + 1}" }): String
Link copied to clipboard
fun handleUiMessageStreamFinish(messages: List<UIMessage>, onFinish: (List<UIMessage>) -> Unit)
Link copied to clipboard
suspend fun pipeTextStreamToResponse(textStream: Flow<String>, response: ServerResponseWriter, status: Int = 200, headers: Map<String, String> = textStreamHeaders())
Link copied to clipboard
suspend fun pipeUiMessageStreamToResponse(stream: Flow<UIMessage>, response: ServerResponseWriter, encoder: (UIMessage) -> String = { "data: ${aiSdkOutputJson.encodeToString(it)}\n\n" }, status: Int = 200, headers: Map<String, String> = uiMessageStreamHeaders())
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard