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
test(sagemaker): assert make_sync_call maps non-200 to SagemakerError
mateo5bc1df5e47e3
diff --git a/tests/test_litellm/llms/sagemaker/test_sagemaker_completion_handler.py b/tests/test_litellm/llms/sagemaker/test_sagemaker_completion_handler.pyindex c2cb46902b8..1cb27b7cf5f 100644--- a/tests/test_litellm/llms/sagemaker/test_sagemaker_completion_handler.py+++ b/tests/test_litellm/llms/sagemaker/test_sagemaker_completion_handler.py@@ -18,6 +18,7 @@ from unittest.mock import MagicMockimport httpximport pytest+from litellm.llms.sagemaker.common_utils import SagemakerErrorfrom litellm.llms.sagemaker.completion.handler import SagemakerLLM@@ -127,6 +128,21 @@ def test_sync_native_streaming_forwards_each_frame_incrementally():assert consumed_at_token == list(range(1, len(frames) + 1))+def test_sync_native_streaming_raises_sagemaker_error_on_non_200():+ response = httpx.Response(500, text="boom")++ with pytest.raises(SagemakerError) as exc_info:+ SagemakerLLM().make_sync_call(+ api_base="https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/phi-4/invocations-response-stream",+ headers={},+ data="",+ logging_obj=MagicMock(),+ client=_FakeSyncClient(response),+ )++ assert exc_info.value.status_code == 500++@pytest.mark.asyncioasync def test_async_native_streaming_forwards_each_frame_incrementally():"""Each token must be emitted after exactly one newly-pulled source frame.