From a389f6bff4db6b0c331960642cb143241fc86df9 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 1 Jul 2024 12:48:56 -0700 Subject: [PATCH] fix(core_helpers.py): map vertex ai 'RECITATION' finish reason to 'content_filter' Fixes https://github.com/BerriAI/litellm/issues/4491 --- litellm/litellm_core_utils/core_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index a325a688561..d8d551048b3 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -26,7 +26,7 @@ def map_finish_reason( finish_reason == "FINISH_REASON_UNSPECIFIED" or finish_reason == "STOP" ): # vertex ai - got from running `print(dir(response_obj.candidates[0].finish_reason))`: ['FINISH_REASON_UNSPECIFIED', 'MAX_TOKENS', 'OTHER', 'RECITATION', 'SAFETY', 'STOP',] return "stop" - elif finish_reason == "SAFETY": # vertex ai + elif finish_reason == "SAFETY" or finish_reason == "RECITATION": # vertex ai return "content_filter" elif finish_reason == "STOP": # vertex ai return "stop"