diff --git a/endpoints/OAI/utils/chat_completion.py b/endpoints/OAI/utils/chat_completion.py index 9393e90..2326bc2 100644 --- a/endpoints/OAI/utils/chat_completion.py +++ b/endpoints/OAI/utils/chat_completion.py @@ -74,7 +74,9 @@ def _create_response( logprob_response = ChatCompletionLogprobs(content=collected_token_probs) - # Finish reason will always be present in a completion + # Initialize finish_reason with a default value or from generation data + finish_reason = generation.get("finish_reason", "stop") + # If a tool call is present, mark the finish reason as such if message.tool_calls: finish_reason = "tool_calls"