update benchmark scripts (#4497)

This commit is contained in:
Zhang Yulong
2025-10-20 17:03:10 +08:00
committed by GitHub
parent b8d235445e
commit 10e85daf15
2 changed files with 7 additions and 2 deletions

View File

@@ -112,6 +112,7 @@ async def async_request_eb_openai_chat_completions(
output = RequestFuncOutput()
output.prompt_len = 0
output.no = request_func_input.no
request_id = "None"
ttft = 0.0
st = time.perf_counter()
@@ -131,6 +132,9 @@ async def async_request_eb_openai_chat_completions(
timestamp = time.perf_counter()
data = json.loads(chunk)
if request_id == "None" and "id" in data:
request_id = data["id"]
if choices := data.get("choices"):
content = choices[0]["delta"].get("content")
reason_content = choices[0]["delta"].get("reasoning_content")
@@ -175,12 +179,13 @@ async def async_request_eb_openai_chat_completions(
)
output.error = error_text or ""
output.success = False
output.request_id = data.get("id", "")
except Exception:
output.success = False
exc_info = sys.exc_info()
output.error = "".join(traceback.format_exception(*exc_info))
output.request_id = request_id
# 保存失败请求结果
if not output.success:
with open("error_output.txt", "a") as f: