diff --git a/tests/unit/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py b/tests/unit/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py index 996f88e7a7d..20e21551a32 100644 --- a/tests/unit/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py +++ b/tests/unit/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py @@ -837,6 +837,7 @@ def _run_transform_response(response_body: dict) -> ModelResponse: {}, {"error": {"message": "upstream broke"}}, {"choices": None}, + {"choices": "not-a-list"}, {"choices": []}, {"choices": [{}]}, {"choices": [{"message": {}}]}, diff --git a/tests/unit/llms/ollama/test_ollama_completion_transformation.py b/tests/unit/llms/ollama/test_ollama_completion_transformation.py index f8c493cc244..26ce84fc14e 100644 --- a/tests/unit/llms/ollama/test_ollama_completion_transformation.py +++ b/tests/unit/llms/ollama/test_ollama_completion_transformation.py @@ -21,7 +21,14 @@ from litellm.types.utils import Message, ModelResponse, ModelResponseStream class TestOllamaConfig: - @pytest.mark.parametrize("body", [{}, {"error": {"message": "upstream broke"}}]) + @pytest.mark.parametrize( + "body", + [ + {}, + {"error": {"message": "upstream broke"}}, + {"response": "", "error": {"message": "upstream broke"}}, + ], + ) def test_transform_response_rejects_payload_without_completion(self, body): raw_response = MagicMock() raw_response.json.return_value = body @@ -620,7 +627,10 @@ class TestOllamaConfig: @pytest.mark.parametrize( "response_body", - [pytest.param({}, id="missing-response"), pytest.param({"error": {"message": "upstream broke"}}, id="error")], + [ + pytest.param({}, id="missing-response"), + pytest.param({"response": "", "error": {"message": "upstream broke"}}, id="error"), + ], ) def test_completion_with_invalid_success_reply_raises_api_connection_error( respx_mock: respx.MockRouter, response_body: dict[str, object]