onModelError
open suspend override fun onModelError(context: CallbackContext, request: LlmRequest, error: Throwable): CallbackChoice<Unit, LlmResponse>
Callback executed when an error occurs during an LLM interaction.
Provides an opportunity to handle model errors gracefully, potentially providing alternative responses or recovery mechanisms.
Return
A CallbackChoice where returning CallbackChoice.Break using a fallback LlmResponse intercepts the error and resolves execution utilizing that fallback response. Returning CallbackChoice.Continue with Unit permits the original error to be propagated.
Parameters
context
The context of the current agent call.
request
The request that was sent to the model when the error occurred.
error
The exception that was raised during model execution.