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]

Merge remote-tracking branch 'origin/main' into litellm_budget_alert_wording

mateo-berrie0ebcb79fc49
diff --cc tests/test_litellm/integrations/SlackAlerting/test_slack_alerting.py
index 6eaa3147dc3,44dda57dd27..4bc6c08bd63
--- a/tests/test_litellm/integrations/SlackAlerting/test_slack_alerting.py
+++ b/tests/test_litellm/integrations/SlackAlerting/test_slack_alerting.py
@@@ -46,9 -45,25 +46,24 @@@ class TestSlackAlerting(unittest.TestCa
result = self.slack_alerting._get_percent_of_max_budget_left(user_info)
self.assertEqual(result, -0.2)
+ def test_get_user_info_str_omits_absent_token_for_user_alert(self):
+ user_info = CallInfo(
+ spend=85.0,
+ max_budget=100.0,
+ user_id="user-1",
+ user_email="[email protected]",
+ event_group=Litellm_EntityType.USER,
+ )
+
+ result = self.slack_alerting._get_user_info_str(user_info)
+
+ self.assertIn("*user_id:* `user-1`", result)
+ self.assertIn("*user_email:* `[email protected]`", result)
+ self.assertNotIn("*token:*", result)
+
def test_get_event_and_event_message_max_budget(self):
- # Initial setup with no event
event = None
- event_message = "Test Message: "
+ event_message = get_budget_alert_type("user_budget").get_event_message()
# Test case 1: When spend exceeds max_budget
user_info = CallInfo(