diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index ba3aee75047..9b0d3a6fefd 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -127,6 +127,7 @@ services = Union[ "datadog_llm_observability", "generic_api", "arize", + "s3", "sqs", ], str, @@ -204,6 +205,7 @@ async def health_services_endpoint( # noqa: PLR0915 "datadog_llm_observability", "generic_api", "arize", + "s3", "sqs", ]: raise HTTPException( @@ -242,6 +244,13 @@ async def health_services_endpoint( # noqa: PLR0915 "status": "success", "message": "Mock LLM request made - check {}.".format(service), } + elif service == "s3": + raise HTTPException( + status_code=422, + detail={ + "error": '"s3" not in proxy config: litellm_settings.success_callback. Unable to test this.' + }, + ) elif service == "datadog": from litellm.integrations.datadog.datadog import DataDogLogger diff --git a/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py b/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py new file mode 100644 index 00000000000..a119d2cd5d8 --- /dev/null +++ b/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py @@ -0,0 +1,28 @@ +from unittest.mock import AsyncMock, patch + +import pytest + +from litellm.proxy.health_endpoints._health_endpoints import health_services_endpoint +from litellm.proxy._types import ProxyException + + +@pytest.mark.asyncio +async def test_health_services_endpoint_accepts_s3_callback(): + with ( + patch("litellm.success_callback", ["s3"]), + patch("litellm.acompletion", new=AsyncMock(return_value={})), + ): + result = await health_services_endpoint(service="s3") + + assert result["status"] == "success" + assert "s3" in result["message"] + + +@pytest.mark.asyncio +async def test_health_services_endpoint_rejects_unconfigured_s3_callback(): + with patch("litellm.success_callback", []): + with pytest.raises(ProxyException) as exc_info: + await health_services_endpoint(service="s3") + + assert exc_info.value.code == "422" + assert "litellm_settings.success_callback" in str(exc_info.value.message)