onLLMStreamingFailed

fun onLLMStreamingFailed(handler: suspend (eventContext: LLMStreamingFailedContext) -> Unit)(source)

Registers a handler to be invoked when an error occurs during streaming.

This handler is called when an error occurs during streaming, allowing you to perform error handling or logging.

Parameters

handler

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

Example:

onLLMStreamingFailed { eventContext ->
logger.error("Stream error for run: ${eventContext.runId}")
}