pub trait AfterModelCallback: Send + Sync {
// Required method
fn on_after_model(
&self,
ctx: &ModelCallbackContext,
result: &ModelCallbackResult,
);
}Expand description
Callback invoked after a model call completes
Use this for:
- Ending LLM spans with token counts
- Recording token usage metrics
- Cost tracking
Required Methods§
Sourcefn on_after_model(
&self,
ctx: &ModelCallbackContext,
result: &ModelCallbackResult,
)
fn on_after_model( &self, ctx: &ModelCallbackContext, result: &ModelCallbackResult, )
Called after a model call finishes