Skip to main content

AfterModelCallback

Trait AfterModelCallback 

Source
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§

Source

fn on_after_model( &self, ctx: &ModelCallbackContext, result: &ModelCallbackResult, )

Called after a model call finishes

Implementors§