Summary
The GenerationOutputMeta dataclass has a time_to_first_token_ms field, but the OpenAI integration never populates it. The integration times the full round-trip (t0 to response) but has no way to measure TTFT from a completed non-streaming response.
Current behavior
build_output_meta in integrations/openai.py constructs GenerationOutputMeta with tokens, cached tokens, reasoning tokens, tps, and stop reason — but time_to_first_token_ms is always None.
Streaming calls (stream=True) are detected but skipped entirely — no inference event is recorded.
Expected behavior
When stream=True, the integration should:
- Wrap the returned iterator
- Record the elapsed time when the first chunk arrives as
time_to_first_token_ms
- Accumulate token counts from chunks
- Record the inference event when the stream is exhausted
Notes
- The field and serialization path already exist — this is purely a capture gap in the integration
- Non-streaming calls cannot produce a meaningful TTFT (the whole response arrives at once), so this only applies to streamed requests
- The same gap exists in the Transformers integration, but that's harder to address without a streaming hook
Workaround
Users can pass TTFT manually today:
output_meta = GenerationOutputMeta(
tokens_out=n,
time_to_first_token_ms=ttft_ms,
)
wildedge.track(model, duration_ms=total_ms, output_meta=output_meta)
Environment
Summary
The
GenerationOutputMetadataclass has atime_to_first_token_msfield, but the OpenAI integration never populates it. The integration times the full round-trip (t0to response) but has no way to measure TTFT from a completed non-streaming response.Current behavior
build_output_metainintegrations/openai.pyconstructsGenerationOutputMetawith tokens, cached tokens, reasoning tokens, tps, and stop reason — buttime_to_first_token_msis alwaysNone.Streaming calls (
stream=True) are detected but skipped entirely — no inference event is recorded.Expected behavior
When
stream=True, the integration should:time_to_first_token_msNotes
Workaround
Users can pass TTFT manually today:
Environment
0.1.1