Skip to content

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]

test(e2e): assert provider error shape instead of pinned prose

Yuneng Jiangbf93483b9536
diff --git a/tests/e2e/llm_translation/test_audio_transcriptions_e2e.py b/tests/e2e/llm_translation/test_audio_transcriptions_e2e.py
index 019c5dac4b0..92b33fef85f 100644
--- a/tests/e2e/llm_translation/test_audio_transcriptions_e2e.py
+++ b/tests/e2e/llm_translation/test_audio_transcriptions_e2e.py
@@ -78,8 +78,12 @@ class TestAudioTranscriptions:
)
match result:
case UnknownApiError(status_code=400, body=body):
- assert "file" in body.lower() or "audio" in body.lower(), (
- f"empty audio error must identify the invalid file: {body[:300]}"
+ assert "OpenAIException" in body, (
+ f"the rejection must relay the provider's own error rather than a "
+ f"litellm-internal failure that hides why the upload was refused: {body[:300]}"
+ )
+ assert "invalid_request_error" in body, (
+ f"an unusable upload must be typed as a client input error: {body[:300]}"
)
case other:
pytest.fail(f"empty audio expected a file-specific 400, got {other!r}")
diff --git a/tests/e2e/logging/test_otel_trace_e2e.py b/tests/e2e/logging/test_otel_trace_e2e.py
index 747fb548e9b..d7b28c170c2 100644
--- a/tests/e2e/logging/test_otel_trace_e2e.py
+++ b/tests/e2e/logging/test_otel_trace_e2e.py
@@ -269,8 +269,12 @@ def _assert_error_span_contract(span: JaegerSpan) -> None:
provider_error = _ProviderError.model_validate_json(message[start : end + 1])
except ValidationError:
pytest.fail(f"the embedded provider error JSON does not parse (truncated?): {message[:300]}")
- assert provider_error.error.message == "invalid x-api-key", (
- f"the embedded provider error must survive untruncated; parsed: {provider_error}"
+ assert provider_error.error.type == "authentication_error", (
+ f"the span must carry anthropic's own auth error object rather than a litellm "
+ f"stand-in; parsed: {provider_error}"
+ )
+ assert provider_error.error.message.strip(), (
+ f"the embedded provider error must carry a non-empty message; parsed: {provider_error}"
)
assert _tag(span, "otel.status_description") == message, (
"the span status description must carry the same untruncated message as error.message"