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 mypy tests
Sameer Kankutee5c3fcbb52eb
diff --git a/litellm/llms/bedrock/chat/invoke_transformations/amazon_moonshot_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/amazon_moonshot_transformation.pyindex 272ab685b64..e53410760dd 100644--- a/litellm/llms/bedrock/chat/invoke_transformations/amazon_moonshot_transformation.py+++ b/litellm/llms/bedrock/chat/invoke_transformations/amazon_moonshot_transformation.py@@ -7,7 +7,7 @@ Model format: bedrock/moonshot.kimi-k2-thinking-v1:0Reference: https://aws.amazon.com/about-aws/whats-new/2025/12/amazon-bedrock-fully-managed-open-weight-models/"""-from typing import TYPE_CHECKING, Any, List, Optional+from typing import TYPE_CHECKING, Any, List, Optional, Unionimport reimport httpx@@ -18,6 +18,7 @@ from litellm.llms.bedrock.chat.invoke_transformations.base_invoke_transformationfrom litellm.llms.bedrock.common_utils import BedrockErrorfrom litellm.llms.moonshot.chat.transformation import MoonshotChatConfigfrom litellm.types.llms.openai import AllMessageValues+from litellm.types.utils import Choicesif TYPE_CHECKING:from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj@@ -234,7 +235,8 @@ class AmazonMoonshotConfig(AmazonInvokeConfig, MoonshotChatConfig):# Extract reasoning content from <reasoning> tagsif model_response.choices and len(model_response.choices) > 0:for choice in model_response.choices:- if choice.message and choice.message.content:+ # Only process Choices (not StreamingChoices) which have message attribute+ if isinstance(choice, Choices) and choice.message and choice.message.content:reasoning_content, main_content = self._extract_reasoning_from_content(choice.message.content)@@ -248,7 +250,7 @@ class AmazonMoonshotConfig(AmazonInvokeConfig, MoonshotChatConfig):return model_responsedef get_error_class(- self, error_message: str, status_code: int, headers: httpx.Headers+ self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]) -> BedrockError:"""Return the appropriate error class for Bedrock."""return BedrockError(status_code=status_code, message=error_message)