Skip to content

Commit 3f3ad1d

Browse files
committed
add
1 parent d727d0f commit 3f3ad1d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

eval_protocol/mcp/execution/manager.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ async def _execute_rollout(
297297
while not turn_completed and not trajectory.terminated:
298298
tool_calls, usage_stats = await policy(tool_schema, rollout_idx, conversation_history)
299299

300+
# calc llm usage stats happened in this turn if there is aany
301+
if usage_stats:
302+
trajectory.usage["prompt_tokens"] += usage_stats.prompt_tokens
303+
trajectory.usage["completion_tokens"] += usage_stats.completion_tokens
304+
trajectory.usage["total_tokens"] += usage_stats.total_tokens
305+
300306
# If no tool call is generated, turn is finished
301307
if len(tool_calls) == 1:
302308
# If there's a user simulator, no tool call means the policy is ready to provide final response on this turn
@@ -373,12 +379,6 @@ async def _execute_rollout(
373379
if observation is not None:
374380
current_observation = observation
375381

376-
# calc llm usage stats happened in this turn if there is aany
377-
if usage_stats:
378-
trajectory.usage["prompt_tokens"] += usage_stats.prompt_tokens
379-
trajectory.usage["completion_tokens"] += usage_stats.completion_tokens
380-
trajectory.usage["total_tokens"] += usage_stats.total_tokens
381-
382382
# With user simulator, increment step after an entire conversation step
383383
if user_simulator is not None:
384384
step += 1

0 commit comments

Comments
 (0)