mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-02 02:11:58 +00:00
Merge c110f5a2aa into 28c0d8579b
This commit is contained in:
commit
7c8ebc4f48
2 changed files with 37 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
Loading…
Add table
Reference in a new issue