10
10
from vllm .outputs import CompletionOutput , RequestOutput
11
11
12
12
13
- # Helper function for Python < 3.10 compatibility
14
- async def async_next (async_iterator ):
15
- """Compatibility function equivalent to Python 3.10's anext()."""
16
- return await async_iterator .__anext__ ()
17
-
18
-
19
13
def create_mock_request_output (
20
14
prompt_token_ids = None ,
21
15
output_token_ids = None ,
@@ -129,7 +123,7 @@ async def test_multi_turn_token_counting():
129
123
)
130
124
131
125
# First turn - initial prompt and response
132
- mock_output1 = await async_next (mock_generator )
126
+ mock_output1 = await anext (mock_generator )
133
127
context .append_output (mock_output1 )
134
128
135
129
# At this point, we should have 5 prompt tokens and 3 output tokens
@@ -138,7 +132,7 @@ async def test_multi_turn_token_counting():
138
132
assert context .num_tool_output_tokens == 0
139
133
140
134
# Second turn - after tool output
141
- mock_output2 = await async_next (mock_generator )
135
+ mock_output2 = await anext (mock_generator )
142
136
context .append_output (mock_output2 )
143
137
# Current prompt tokens (15) - last_turn_input_tokens (5) -
144
138
# last_turn_output_tokens (3) = 7
@@ -150,7 +144,7 @@ async def test_multi_turn_token_counting():
150
144
assert context .num_cached_tokens == 5
151
145
152
146
# Third turn - final response
153
- mock_output3 = await async_next (mock_generator )
147
+ mock_output3 = await anext (mock_generator )
154
148
context .append_output (mock_output3 )
155
149
# Additional tool output tokens from third turn:
156
150
# Current prompt (20) - last_turn_input_tokens (15) -
0 commit comments