<<<<<<< HEAD ======= >>>>>>> 0a75ee1214dbcf88620b703810fab9e09d8c89fb

beforeModel

Callback executed before an LLM request is sent.

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.