mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(utils.py): fix vertex ai finish reason handling
This commit is contained in:
parent
4e9210906b
commit
00d628544c
1 changed files with 5 additions and 1 deletions
|
@ -8538,7 +8538,11 @@ class CustomStreamWrapper:
|
||||||
if hasattr(chunk, "candidates") == True:
|
if hasattr(chunk, "candidates") == True:
|
||||||
try:
|
try:
|
||||||
completion_obj["content"] = chunk.text
|
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 = (
|
model_response.choices[0].finish_reason = (
|
||||||
map_finish_reason(
|
map_finish_reason(
|
||||||
chunk.candidates[0].finish_reason.name
|
chunk.candidates[0].finish_reason.name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue