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: update test

Krrish Dholakiaa552da5eef25
diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.py
index 724b0eefcf9..b7018fe29f9 100644
--- a/litellm/types/guardrails.py
+++ b/litellm/types/guardrails.py
@@ -156,7 +156,7 @@ class GuardrailLiteLLMParamsResponse(BaseModel):
class GuardrailInfoResponse(BaseModel):
- guardrail_name: Optional[str]
+ guardrail_name: str
litellm_params: GuardrailLiteLLMParamsResponse
guardrail_info: Optional[Dict]
diff --git a/tests/logging_callback_tests/test_custom_guardrail.py b/tests/logging_callback_tests/test_custom_guardrail.py
index ae8b8c0c1dc..af1270756f2 100644
--- a/tests/logging_callback_tests/test_custom_guardrail.py
+++ b/tests/logging_callback_tests/test_custom_guardrail.py
@@ -156,6 +156,12 @@ def test_get_guardrails_list_response():
sample_config = [
{
"guardrail_name": "test-guard",
+ "litellm_params": {
+ "guardrail": "test-guard",
+ "mode": "pre_call",
+ "api_key": "test-api-key",
+ "api_base": "test-api-base",
+ },
"guardrail_info": {
"params": [
{
@@ -188,7 +194,12 @@ def test_get_guardrails_list_response():
assert len(empty_response.guardrails) == 0
# Test case 3: Missing optional fields
- minimal_config = [{"guardrail_name": "minimal-guard"}]
+ minimal_config = [
+ {
+ "guardrail_name": "minimal-guard",
+ "litellm_params": {"guardrail": "minimal-guard", "mode": "pre_call"},
+ }
+ ]
minimal_response = _get_guardrails_list_response(minimal_config)
assert isinstance(minimal_response, ListGuardrailsResponse)
assert len(minimal_response.guardrails) == 1