We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9783a8 commit 30db3e9Copy full SHA for 30db3e9
1 file changed
benchmarks/backend_request_func.py
@@ -428,6 +428,15 @@ async def async_request_eb_openai_chat_completions(
428
# output.generated_text = generated_text
429
# 在流式结束时,记录最后一个 chunk 收到的时间戳
430
output.end_timestamp = most_recent_timestamp
431
+ # 截断case也记录usage
432
+ usage = data.get("usage", {})
433
+ if usage:
434
+ output.output_tokens = usage.get("completion_tokens", 0)
435
+ output.prompt_tokens = usage.get("prompt_tokens", 0)
436
+ if output.prompt_len == 0:
437
+ prompt_details = usage.get("prompt_tokens_details", {})
438
+ if prompt_details:
439
+ output.prompt_len = prompt_details.get("cached_tokens", 0)
440
441
if tool_call_buffer:
442
for _, tc in tool_call_buffer.items():
0 commit comments