onLLMStreamingCompleted

fun onLLMStreamingCompleted(handler: suspend (eventContext: LLMStreamingCompletedContext) -> Unit)(source)

Registers a handler to be invoked after streaming from a language model completes.

This handler is called when the streaming operation finishes, allowing you to perform post-processing, cleanup, or final logging operations.

Parameters

handler

The handler function that receives an LLMStreamingCompletedContext containing the run ID, prompt, model, and tools that were used for the streaming session.

Example:

onLLMStreamingCompleted { eventContext ->
logger.info("Stream completed for run: ${eventContext.runId}")
// Perform any cleanup or aggregation of collected stream data
}