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_patch_guardrail_endpoint

Ishaan Jaffer45323dd537ac
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index e24fca72094..9f020fc1ebf 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -11617,7 +11617,7 @@
"tpm": 1000000
},
"gemini/gemini-2.5-flash": {
- "cache_read_input_token_cost": 7.5e-08,
+ "cache_read_input_token_cost": 3e-08,
"input_cost_per_audio_token": 1e-06,
"input_cost_per_token": 3e-07,
"litellm_provider": "gemini",
diff --git a/tests/test_litellm/proxy/guardrails/test_guardrail_endpoints.py b/tests/test_litellm/proxy/guardrails/test_guardrail_endpoints.py
index a2d072dc7d8..2292bf32040 100644
--- a/tests/test_litellm/proxy/guardrails/test_guardrail_endpoints.py
+++ b/tests/test_litellm/proxy/guardrails/test_guardrail_endpoints.py
@@ -751,13 +751,14 @@ async def test_patch_guardrail_endpoint(
mock_logger = None
if scenario == "success_with_sync":
mock_prisma_client = mocker.Mock()
+ mock_in_memory_handler.sync_guardrail_from_db = mocker.Mock()
mocker.patch("litellm.proxy.proxy_server.prisma_client", mock_prisma_client)
mocker.patch("litellm.proxy.guardrails.guardrail_endpoints.GUARDRAIL_REGISTRY", mock_guardrail_registry)
mocker.patch("litellm.proxy.guardrails.guardrail_registry.IN_MEMORY_GUARDRAIL_HANDLER", mock_in_memory_handler)
elif scenario == "success_sync_fails":
mock_prisma_client = mocker.Mock()
- mock_in_memory_handler.update_in_memory_guardrail.side_effect = Exception("Sync failed")
+ mock_in_memory_handler.sync_guardrail_from_db = mocker.Mock(side_effect=Exception("Sync failed"))
mock_logger = mocker.patch("litellm.proxy.guardrails.guardrail_endpoints.verbose_proxy_logger")
mocker.patch("litellm.proxy.proxy_server.prisma_client", mock_prisma_client)
@@ -792,8 +793,7 @@ async def test_patch_guardrail_endpoint(
mock_guardrail_registry.update_guardrail_in_db.assert_called_once()
- mock_in_memory_handler.update_in_memory_guardrail.assert_called_once_with(
- guardrail_id="test-guardrail-id",
+ mock_in_memory_handler.sync_guardrail_from_db.assert_called_once_with(
guardrail=mocker.ANY
)