Interface: GenerationStats
Defined in: lib/types/dispatch_runner.ts:250
Provider-agnostic generation accounting for a single completed generation, emitted via DispatchExecutorHelpers.reportGenerationStats.
Remarks
Every field is optional so each battery supplies only what its wire format reports — OpenAI Chat Completions surfaces token counts (its usage block) but no wall-clock durations; Ollama's native /api/chat surfaces both token counts and nanosecond durations on its terminal chunk.
Durations are carried in their native nanosecond unit (the Ns suffix is load-bearing) and are never normalised here — normalising to milliseconds would be lossy and providers without durations would gain meaningless zeros. raw preserves the full provider-native stats object verbatim for forward-compatibility, so a subscriber can read a field this shape has not yet promoted to a typed member.
Extended by
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
completionTokens? | number | Tokens in the completion / output (OpenAI usage.completion_tokens, Ollama eval_count). | lib/types/dispatch_runner.ts:254 |
evalDurationNs? | number | Time spent generating the response in nanoseconds (Ollama eval_duration). | lib/types/dispatch_runner.ts:264 |
finishReason? | string | Why generation stopped (Ollama done_reason, OpenAI finish_reason). | lib/types/dispatch_runner.ts:266 |
loadDurationNs? | number | Time spent loading the model in nanoseconds (Ollama load_duration). | lib/types/dispatch_runner.ts:260 |
model? | string | Model identifier the provider echoed back. | lib/types/dispatch_runner.ts:268 |
promptEvalDurationNs? | number | Time spent evaluating the prompt in nanoseconds (Ollama prompt_eval_duration). | lib/types/dispatch_runner.ts:262 |
promptTokens? | number | Tokens in the prompt / input (OpenAI usage.prompt_tokens, Ollama prompt_eval_count). | lib/types/dispatch_runner.ts:252 |
provider? | string | Stable provider discriminator (e.g. 'ollama', 'openai_chat_completions'). | lib/types/dispatch_runner.ts:270 |
raw? | Record<string, unknown> | Full provider-native stats object, verbatim, for forward-compatibility. | lib/types/dispatch_runner.ts:272 |
totalDurationNs? | number | Total wall-clock generation time in nanoseconds (Ollama total_duration). | lib/types/dispatch_runner.ts:258 |
totalTokens? | number | Total tokens, when the provider reports a combined figure. | lib/types/dispatch_runner.ts:256 |