mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-04 08:16:42 +08:00
[RL] update reschedule finish reason (#2709)
This commit is contained in:
@@ -122,7 +122,7 @@ class ChatCompletionResponseChoice(BaseModel):
|
|||||||
"""
|
"""
|
||||||
index: int
|
index: int
|
||||||
message: ChatMessage
|
message: ChatMessage
|
||||||
finish_reason: Optional[Literal["stop", "length", "tool_calls"]]
|
finish_reason: Optional[Literal["stop", "length", "tool_calls", "recover_stop"]]
|
||||||
|
|
||||||
|
|
||||||
class ChatCompletionResponse(BaseModel):
|
class ChatCompletionResponse(BaseModel):
|
||||||
|
@@ -222,7 +222,7 @@ class OpenAIServingChat:
|
|||||||
choice.finish_reason = "length"
|
choice.finish_reason = "length"
|
||||||
|
|
||||||
if res.get("error_msg") is not None and "Recover" in res["error_msg"]:
|
if res.get("error_msg") is not None and "Recover" in res["error_msg"]:
|
||||||
choice.finish_reason = "length"
|
choice.finish_reason = "recover_stop"
|
||||||
|
|
||||||
if request.metadata is not None and request.metadata.get("training", False) and delta_text != "":
|
if request.metadata is not None and request.metadata.get("training", False) and delta_text != "":
|
||||||
choice.delta.token_ids = output["token_ids"]
|
choice.delta.token_ids = output["token_ids"]
|
||||||
@@ -340,7 +340,7 @@ class OpenAIServingChat:
|
|||||||
choice.finish_reason = "length"
|
choice.finish_reason = "length"
|
||||||
|
|
||||||
if final_res.get("error_msg") is not None and "Recover" in final_res["error_msg"]:
|
if final_res.get("error_msg") is not None and "Recover" in final_res["error_msg"]:
|
||||||
choice.finish_reason = "length"
|
choice.finish_reason = "recover_stop"
|
||||||
choices.append(choice)
|
choices.append(choice)
|
||||||
|
|
||||||
num_prompt_tokens = len(prompt_token_ids)
|
num_prompt_tokens = len(prompt_token_ids)
|
||||||
|
Reference in New Issue
Block a user