diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index 22006be21af..85e2b970cfb 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -65,7 +65,7 @@ _FINISH_REASON_MAP: dict[str, OpenAIChatCompletionFinishReason] = { "max_tokens": "length", "tool_use": "tool_calls", "refusal": "content_filter", - "compaction": "length", + "compaction": "stop", # Cohere "COMPLETE": "stop", "ERROR_TOXIC": "content_filter", diff --git a/tests/test_litellm/litellm_core_utils/test_core_helpers.py b/tests/test_litellm/litellm_core_utils/test_core_helpers.py index 8397fc22242..8f0c6d418c5 100644 --- a/tests/test_litellm/litellm_core_utils/test_core_helpers.py +++ b/tests/test_litellm/litellm_core_utils/test_core_helpers.py @@ -66,7 +66,7 @@ class TestMapFinishReasonAnthropic: ("end_turn", "stop"), ("max_tokens", "length"), ("tool_use", "tool_calls"), - ("compaction", "length"), + ("compaction", "stop"), ("content_filtered", "content_filter"), ], )