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(types): annotate _FINISH_REASON_MAP and map_finish_reason with OpenAIChatCompletionFinishReason
Chesarsb6784e7d8c2e
diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.pyindex 5dad19f2599..ee111f35929 100644--- a/litellm/litellm_core_utils/core_helpers.py+++ b/litellm/litellm_core_utils/core_helpers.py@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any, Iterable, List, Literal, Optional, Unionimport httpxfrom litellm._logging import verbose_logger-from litellm.types.llms.openai import AllMessageValues+from litellm.types.llms.openai import AllMessageValues, OpenAIChatCompletionFinishReasonif TYPE_CHECKING:from opentelemetry.trace import Span as _Span@@ -58,7 +58,7 @@ def safe_divide(return numerator / denominator-_FINISH_REASON_MAP = {+_FINISH_REASON_MAP: dict[str, OpenAIChatCompletionFinishReason] = {# Anthropic"stop_sequence": "stop","end_turn": "stop",@@ -99,7 +99,7 @@ _FINISH_REASON_MAP = {}-def map_finish_reason(finish_reason: str) -> str:+def map_finish_reason(finish_reason: str) -> OpenAIChatCompletionFinishReason:mapped = _FINISH_REASON_MAP.get(finish_reason)if mapped is None:verbose_logger.warning(