refactor!: partition ModelOutputThunk execution metadata into Generat…#908
refactor!: partition ModelOutputThunk execution metadata into Generat…#908ajbozarth wants to merge 2 commits intogenerative-computing:mainfrom
Conversation
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
…ionMetadata Group the five flat telemetry fields (usage, model, provider, ttfb_ms, streaming) into a new GenerationMetadata dataclass accessed as mot.generation. This keeps __init__, _copy_from, __copy__, and __deepcopy__ lean as the metadata surface grows, and gives type-safe access to all five fields under a single namespace. BREAKING CHANGE: mot.usage, mot.model, mot.provider, mot.ttfb_ms, and mot.streaming are removed. Access them as mot.generation.usage, mot.generation.model, mot.generation.provider, mot.generation.ttfb_ms, and mot.generation.streaming respectively. Assisted-by: Claude Code Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
b15e069 to
45b687d
Compare
|
@planetf1 Cross-reference for #891 implementation: this PR removed the five flat execution-metadata fields ( The streaming path introduced by #891 will interact with at least Minor: sub-issue #901 cites |
|
@ajbozarth thanks. One other note I found -- |
- Copy GenerationMetadata in __copy__ rather than sharing the instance by reference, so post-copy mutations don't bleed across both objects - Tighten build_completion_usage signature from Any to ModelOutputThunk Assisted-by: Claude Code Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
Misc PR
Type of PR
Description
Groups the five flat execution-metadata fields (
usage,model,provider,ttfb_ms,streaming) fromModelOutputThunkinto a singleGenerationMetadatadataclass accessed as
mot.generation. This was motivated by__init__,_copy_from,__copy__, and__deepcopy__growing a new line with everytelemetry field addition — the sub-object keeps those methods lean as the
metadata surface grows and gives callers a typed namespace.
mot.usage,mot.model,mot.provider,mot.ttfb_ms,and
mot.streamingare removed — usemot.generation.*instead.All five fields were added ~5 weeks ago as part of the same telemetry epic, so
this is a hard break with no deprecated aliases. All callers in
mellea/,cli/,test/, anddocs/have been updated in this PR.Changed files:
mellea/core/base.py— newGenerationMetadatadataclass;ModelOutputThunkreplaces 5 flat fields withself.generationmellea/core/__init__.py— exportsGenerationMetadatamellea/backends/{openai,litellm,ollama,watsonx,huggingface}.py—mot.*→mot.generation.*inpost_processing()mellea/telemetry/metrics_plugins.py— updated all 4 plugins to read viamot.generationmellea/helpers/openai_compatible_helpers.py—build_completion_usageupdated to readoutput.generation.usagetest/backends/test_{ollama,openai_ollama,litellm_ollama,watsonx,huggingface}.py— assertion updatestest/cli/test_{serve,serve_streaming,serve_errors}.py— fixture/setup updatestest/core/test_base.py— new copy semantics tests forGenerationMetadatatest/telemetry/test_metrics_plugins.py— updated helpers to useGenerationMetadataconstructorAGENTS.md,docs/docs/evaluation-and-observability/metrics.md,docs/examples/telemetry/metrics_example.py— updated field referencesTesting
Attribution