Skip to content
2 min read · 370 words

Interface: GenerationStatsEvent

Defined in: src/lib/types/dispatch_runner.ts:312

Payload fired on the observability generationStats hook for every record emitted via DispatchExecutorHelpers.reportGenerationStats.

Remarks

The runner enriches the executor-supplied GenerationStats with the active dispatchId and 0-based iteration index (and an emittedAt timestamp) so subscribers can correlate stats across multiple in-flight dispatches without threading extra context — exactly as LogEvent does for the log channel.

Extends

Properties

PropertyTypeDescriptionInherited fromDefined in
completionTokens?numberTokens in the completion / output (OpenAI usage.completion_tokens, Ollama eval_count).GenerationStats.completionTokenssrc/lib/types/dispatch_runner.ts:281
dispatchIdstringStable identifier for the dispatch that produced the event.-src/lib/types/dispatch_runner.ts:314
emittedAtDateTimeWhen the event was emitted.-src/lib/types/dispatch_runner.ts:318
evalDurationNs?numberTime spent generating the response in nanoseconds (Ollama eval_duration).GenerationStats.evalDurationNssrc/lib/types/dispatch_runner.ts:291
finishReason?stringWhy generation stopped (Ollama done_reason, OpenAI finish_reason).GenerationStats.finishReasonsrc/lib/types/dispatch_runner.ts:293
iterationnumber0-based iteration index within the dispatch.-src/lib/types/dispatch_runner.ts:316
loadDurationNs?numberTime spent loading the model in nanoseconds (Ollama load_duration).GenerationStats.loadDurationNssrc/lib/types/dispatch_runner.ts:287
model?stringModel identifier the provider echoed back.GenerationStats.modelsrc/lib/types/dispatch_runner.ts:295
promptEvalDurationNs?numberTime spent evaluating the prompt in nanoseconds (Ollama prompt_eval_duration).GenerationStats.promptEvalDurationNssrc/lib/types/dispatch_runner.ts:289
promptTokens?numberTokens in the prompt / input (OpenAI usage.prompt_tokens, Ollama prompt_eval_count).GenerationStats.promptTokenssrc/lib/types/dispatch_runner.ts:279
provider?stringStable provider discriminator (e.g. 'ollama', 'openai_chat_completions').GenerationStats.providersrc/lib/types/dispatch_runner.ts:297
raw?Record<string, unknown>Full provider-native stats object, verbatim, for forward-compatibility.GenerationStats.rawsrc/lib/types/dispatch_runner.ts:299
totalDurationNs?numberTotal wall-clock generation time in nanoseconds (Ollama total_duration).GenerationStats.totalDurationNssrc/lib/types/dispatch_runner.ts:285
totalTokens?numberTotal tokens, when the provider reports a combined figure.GenerationStats.totalTokenssrc/lib/types/dispatch_runner.ts:283