@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 33278073d6
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 11, 11:15 UTC

typing: Add type hints to TurnMetrics class in context.py (#30552)

Co-authored-by: zkexorability <zkexorability@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

ゆり committed Dec 15, 2025 at 16:00 UTC 33278073d68940dcaff579ab2dc316700e1db87a
1 file changed +7 -7
vllm/entrypoints/context.py
+7 -7
@@ -74,24 +74,24 @@ class TurnMetrics:
74
75 def __init__(
76 self,
77 - input_tokens=0,
78 - output_tokens=0,
79 - cached_input_tokens=0,
80 - tool_output_tokens=0,
81 - ):
77 + input_tokens: int = 0,
78 + output_tokens: int = 0,
79 + cached_input_tokens: int = 0,
80 + tool_output_tokens: int = 0,
81 + ) -> None:
82 self.input_tokens = input_tokens
83 self.output_tokens = output_tokens
84 self.cached_input_tokens = cached_input_tokens
85 self.tool_output_tokens = tool_output_tokens
86
87 - def reset(self):
87 + def reset(self) -> None:
88 """Reset counters for a new turn."""
89 self.input_tokens = 0
90 self.output_tokens = 0
91 self.cached_input_tokens = 0
92 self.tool_output_tokens = 0
93
94 - def copy(self):
94 + def copy(self) -> "TurnMetrics":
95 """Create a copy of this turn's token counts."""
96 return TurnMetrics(
97 self.input_tokens,