The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: map Zhipu GLM non-standard finish_reason values
Chesars6a466913fc85
diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.pyindex 22006be21af..0f0d6631adb 100644--- a/litellm/litellm_core_utils/core_helpers.py+++ b/litellm/litellm_core_utils/core_helpers.py@@ -89,6 +89,9 @@ _FINISH_REASON_MAP: dict[str, OpenAIChatCompletionFinishReason] = {"IMAGE_PROHIBITED_CONTENT": "content_filter","TOO_MANY_TOOL_CALLS": "stop","MALFORMED_RESPONSE": "stop",+ # Zhipu GLM+ "network_error": "stop",+ "sensitive": "content_filter",# Bedrock"guardrail_intervened": "content_filter",# OpenAI passthroughdiff --git a/tests/test_litellm/litellm_core_utils/test_core_helpers.py b/tests/test_litellm/litellm_core_utils/test_core_helpers.pyindex 8397fc22242..0519ac6a8fc 100644--- a/tests/test_litellm/litellm_core_utils/test_core_helpers.py+++ b/tests/test_litellm/litellm_core_utils/test_core_helpers.py@@ -126,6 +126,14 @@ class TestMapFinishReasonBedrock:assert map_finish_reason("guardrail_intervened") == "content_filter"+class TestMapFinishReasonZhipu:+ def test_network_error(self):+ assert map_finish_reason("network_error") == "stop"++ def test_sensitive(self):+ assert map_finish_reason("sensitive") == "content_filter"++class TestMapFinishReasonOpenAIPassthrough:@pytest.mark.parametrize("reason", ["stop", "length", "tool_calls", "function_call", "content_filter"]