Skip to main content

mellea.plugins.builtin_debug.generation

Built-in debug plugin for generation pipeline (pre-call and post-call).

Provides tracing for all LLM backend calls. Use for debugging model invocations, tracking latency, and understanding request/response flow.

Examples: Enable generation tracing:

from mellea.plugins.builtin_debug.generation import ( log_generation_pre_call, log_generation_post_call, ) from mellea import start_session from mellea.plugins import register

register([log_generation_pre_call, log_generation_post_call])

with start_session() as m: result = m.instruct("...") # Tracing fires automatically

Functions

FUNC log_generation_pre_call

log_generation_pre_call(payload: GenerationPreCallPayload, ctx: PluginContext) -> None

Log request details before calling the LLM.

Args:

  • payload: GenerationPreCallPayload containing action, generation_id.
  • ctx: Plugin context for hook execution; backend_name is in global_context.state.

FUNC log_generation_post_call

log_generation_post_call(payload: GenerationPostCallPayload, ctx: PluginContext) -> None

Log response details after LLM returns.

Args:

  • payload: GenerationPostCallPayload containing model_output, generation_id, latency_ms.
  • ctx: Plugin context for hook execution; backend_name is in global_context.state.