call
abstract suspend fun call(context: CallbackContext, request: LlmRequest): CallbackChoice<LlmRequest, LlmResponse>
Callback executed before a request is sent to the model.
Provides an opportunity to inspect, log, or modify the LlmRequest object. It can also be used to implement caching by returning a cached LlmResponse, which skips the actual model call.
Return
A CallbackChoice where returning CallbackChoice.Break with a custom LlmResponse triggers an early exit, returning the response immediately and bypassing the model call. Returning CallbackChoice.Continue with a potentially modified LlmRequest propagates the request to the model normally.
Parameters
context
The context of the current agent call.
request
The prepared request object to be sent to the model.