mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-11 16:26:07 +00:00
fix(utils.py): fix vertex ai finish reason handling
This commit is contained in:
+5
-1
@@ -8538,7 +8538,11 @@ class CustomStreamWrapper:
|
||||
if hasattr(chunk, "candidates") == True:
|
||||
try:
|
||||
completion_obj["content"] = chunk.text
|
||||
if hasattr(chunk.candidates[0], "finish_reason"):
|
||||
if (
|
||||
hasattr(chunk.candidates[0], "finish_reason")
|
||||
and chunk.candidates[0].finish_reason.name
|
||||
!= "FINISH_REASON_UNSPECIFIED"
|
||||
): # every non-final chunk in vertex ai has this
|
||||
model_response.choices[0].finish_reason = (
|
||||
map_finish_reason(
|
||||
chunk.candidates[0].finish_reason.name
|
||||
|
||||
Reference in New Issue
Block a user