Skip to content
2 min read · 370 words

Interface: GenerationStatsEvent

Defined in: lib/types/dispatch_runner.ts:285

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.completionTokenslib/types/dispatch_runner.ts:254
dispatchIdstringStable identifier for the dispatch that produced the event.-lib/types/dispatch_runner.ts:287
emittedAtDateTimeWhen the event was emitted.-lib/types/dispatch_runner.ts:291
evalDurationNs?numberTime spent generating the response in nanoseconds (Ollama eval_duration).GenerationStats.evalDurationNslib/types/dispatch_runner.ts:264
finishReason?stringWhy generation stopped (Ollama done_reason, OpenAI finish_reason).GenerationStats.finishReasonlib/types/dispatch_runner.ts:266
iterationnumber0-based iteration index within the dispatch.-lib/types/dispatch_runner.ts:289
loadDurationNs?numberTime spent loading the model in nanoseconds (Ollama load_duration).GenerationStats.loadDurationNslib/types/dispatch_runner.ts:260
model?stringModel identifier the provider echoed back.GenerationStats.modellib/types/dispatch_runner.ts:268
promptEvalDurationNs?numberTime spent evaluating the prompt in nanoseconds (Ollama prompt_eval_duration).GenerationStats.promptEvalDurationNslib/types/dispatch_runner.ts:262
promptTokens?numberTokens in the prompt / input (OpenAI usage.prompt_tokens, Ollama prompt_eval_count).GenerationStats.promptTokenslib/types/dispatch_runner.ts:252
provider?stringStable provider discriminator (e.g. 'ollama', 'openai_chat_completions').GenerationStats.providerlib/types/dispatch_runner.ts:270
raw?Record<string, unknown>Full provider-native stats object, verbatim, for forward-compatibility.GenerationStats.rawlib/types/dispatch_runner.ts:272
totalDurationNs?numberTotal wall-clock generation time in nanoseconds (Ollama total_duration).GenerationStats.totalDurationNslib/types/dispatch_runner.ts:258
totalTokens?numberTotal tokens, when the provider reports a combined figure.GenerationStats.totalTokenslib/types/dispatch_runner.ts:256