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_delete_callbacks_in_db

Ishaan Jaffer5157078e0ad7
diff --git a/tests/llm_translation/test_bedrock_completion.py b/tests/llm_translation/test_bedrock_completion.py
index 7b9a69c4815..7f20dfaa0f5 100644
--- a/tests/llm_translation/test_bedrock_completion.py
+++ b/tests/llm_translation/test_bedrock_completion.py
@@ -2341,7 +2341,8 @@ def test_bedrock_custom_continue_message():
def test_bedrock_no_default_message():
"""
- Test that empty content is preserved when modify_params=False
+ Test that empty content is replaced with placeholder when modify_params=False.
+ AWS Bedrock doesn't allow empty or whitespace-only text content.
"""
messages = [
{"role": "user", "content": "Hello!"},
@@ -2357,15 +2358,13 @@ def test_bedrock_no_default_message():
llm_provider="bedrock",
)
- # Verify empty message is present and valid message remains
+ # Verify empty message is replaced with placeholder and valid message remains
assistant_messages = [
msg for msg in formatted_messages if msg["role"] == "assistant"
]
- assert len(assistant_messages) == 2 # Both empty and valid messages present
- assert assistant_messages[0]["content"][0]["text"] == "" # First message is empty
- assert (
- assistant_messages[1]["content"][0]["text"] == "Valid response"
- ) # Second message is valid
+ assert len(assistant_messages) == 2
+ assert assistant_messages[0]["content"][0]["text"] == "."
+ assert assistant_messages[1]["content"][0]["text"] == "Valid response"
@pytest.mark.parametrize("top_k_param", ["top_k", "topK"])
diff --git a/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py b/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py
index 9dac72aac44..161f5713f26 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_delete_callbacks_endpoint.py
@@ -118,7 +118,22 @@ def mock_decrypt_value_helper(value, key=None, return_original_value=False):
@pytest.mark.asyncio
async def test_delete_callbacks_in_db(mock_prisma, mock_auth):
+ # Create mock proxy_config
+ mock_proxy_config = MagicMock()
+ mock_proxy_config.get_config = AsyncMock(return_value={
+ "litellm_settings": {"success_callback": ["langfuse"]},
+ "environment_variables": {
+ "LANGFUSE_PUBLIC_KEY": "any-public-key",
+ "LANGFUSE_SECRET_KEY": "any-secret-key",
+ "LANGFUSE_HOST": "https://exampleopenaiendpoint-production-c715.up.railway.app",
+ },
+ })
+ mock_proxy_config.save_config = AsyncMock()
+ mock_proxy_config.add_deployment = AsyncMock()
+
with patch("litellm.proxy.proxy_server.prisma_client", mock_prisma), \
+ patch("litellm.proxy.proxy_server.proxy_config", mock_proxy_config), \
+ patch("litellm.proxy.proxy_server.proxy_logging_obj", MagicMock()), \
patch("litellm.proxy.proxy_server.store_model_in_db", True), \
patch("litellm.proxy.proxy_server.encrypt_value_helper", side_effect=mock_encrypt_value_helper), \
patch("litellm.proxy.proxy_server.decrypt_value_helper", side_effect=mock_decrypt_value_helper):