mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[BugFix] Fix finish reason in _create_chat_completion_choice (#4582)
* fix n_param _create_chat_completion_choicel * fix unit test * fix final_res * modify unit tests
This commit is contained in:
@@ -621,7 +621,7 @@ class OpenAIServingChat:
|
||||
|
||||
if output is not None and output.get("metrics") and output["metrics"].get("request_start_time"):
|
||||
work_process_metrics.e2e_request_latency.observe(
|
||||
time.time() - output.get("metrics").get("request_start_time")
|
||||
time.time() - data.get("metrics").get("request_start_time")
|
||||
)
|
||||
message = ChatMessage(
|
||||
role="assistant",
|
||||
@@ -655,7 +655,7 @@ class OpenAIServingChat:
|
||||
finish_reason = "tool_calls"
|
||||
else:
|
||||
finish_reason = "length"
|
||||
if output.get("error_msg") is not None and "Recover" in output["error_msg"]:
|
||||
if data.get("error_msg") is not None and "Recover" in data["error_msg"]:
|
||||
finish_reason = "recover_stop"
|
||||
|
||||
return ChatCompletionResponseChoice(
|
||||
|
||||
Reference in New Issue
Block a user