afterModel

open suspend override fun afterModel(context: CallbackContext, response: LlmResponse): LlmResponse

Callback executed after an LLM response is received.

This is the ideal place to log model responses, collect metrics on token usage, or perform post-processing on the raw LlmResponse.

Return

The potentially modified LlmResponse to propagate down the chain.

Parameters

context

The context of the current agent call.

response

The response object received from the model.