Bugfix: Chat completion requests fail with UnboundLocalError: finish_reason variable not initialized (#307)
* fix issue #306 * removed whitespaces for ruff
This commit is contained in:
parent
d98c0bd3f6
commit
a20abe2d33
1 changed files with 3 additions and 1 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue