[RL] update reschedule finish reason (#2709)

This commit is contained in:
ltd0924
2025-07-04 13:47:36 +08:00
committed by GitHub
parent 667547be59
commit 87e638498c
2 changed files with 3 additions and 3 deletions

View File

@@ -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):

View File

@@ -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)