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]

fix: resolve type gate regressions in prometheus caller identity validation

Devin AI64c893107722
diff --git a/basedpyright-code-budget.json b/basedpyright-code-budget.json
index 6ce2f43e5ce..225a2c04339 100644
--- a/basedpyright-code-budget.json
+++ b/basedpyright-code-budget.json
@@ -1,6 +1,6 @@
{
"reportAny": {
- "limit": 18494
+ "limit": 18483
},
"reportArgumentType": {
"limit": 2564
@@ -24,7 +24,7 @@
"limit": 19
},
"reportExplicitAny": {
- "limit": 5968
+ "limit": 5960
},
"reportFunctionMemberAccess": {
"limit": 7
@@ -57,7 +57,7 @@
"limit": 5659
},
"reportMissingTypeArgument": {
- "limit": 15494
+ "limit": 15484
},
"reportMissingTypeStubs": {
"limit": 40
@@ -105,13 +105,13 @@
"limit": 109
},
"reportUnknownMemberType": {
- "limit": 38818
+ "limit": 38808
},
"reportUnknownParameterType": {
- "limit": 19838
+ "limit": 19829
},
"reportUnknownVariableType": {
- "limit": 30371
+ "limit": 30356
},
"reportUnnecessaryCast": {
"limit": 117
diff --git a/litellm/types/integrations/prometheus.py b/litellm/types/integrations/prometheus.py
index b9dc6a1aad6..2c38c55d304 100644
--- a/litellm/types/integrations/prometheus.py
+++ b/litellm/types/integrations/prometheus.py
@@ -332,16 +332,17 @@ def validate_caller_identity_settings(litellm_settings: Mapping[str, object]) ->
that request a label the selected mode removes."""
if "prometheus_deployment_and_latency_caller_identity" not in litellm_settings:
return
- litellm.prometheus_deployment_and_latency_caller_identity = cast(
+ litellm.prometheus_deployment_and_latency_caller_identity = cast( # cast-ok: validated on the next line, which raises on an invalid value
'Literal["api_key_alias", "user_email", "both"]',
litellm_settings["prometheus_deployment_and_latency_caller_identity"],
- ) # cast-ok: validated on the next line, which raises on an invalid value
+ )
caller_identity_mode: Final = validate_prometheus_deployment_and_latency_caller_identity()
if caller_identity_mode != "user_email":
return
+ raw_metrics_config: Final = litellm_settings.get("prometheus_metrics_config")
conflicting_metrics: Final = tuple(
metric_name
- for metric_config in (litellm_settings.get("prometheus_metrics_config") or ())
+ for metric_config in (raw_metrics_config if isinstance(raw_metrics_config, list) else ())
if isinstance(metric_config, dict) and "api_key_alias" in (metric_config.get("include_labels") or ())
for metric_name in (metric_config.get("metrics") or ())
if metric_name in PROMETHEUS_DEPLOYMENT_AND_LATENCY_CALLER_IDENTITY_METRICS
diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json
index a6aea082b37..d5d24904a71 100644
--- a/ruff-strict-budget.json
+++ b/ruff-strict-budget.json
@@ -12,10 +12,10 @@
"limit": 2012
},
"ANN202": {
- "limit": 848
+ "limit": 847
},
"ANN204": {
- "limit": 707
+ "limit": 706
},
"ANN205": {
"limit": 112
@@ -24,7 +24,7 @@
"limit": 133
},
"ANN401": {
- "limit": 1155
+ "limit": 1153
},
"ASYNC230": {
"limit": 11
diff --git a/type-discipline-budget.json b/type-discipline-budget.json
index 2b8c36208f1..4465580657b 100644
--- a/type-discipline-budget.json
+++ b/type-discipline-budget.json
@@ -1,9 +1,9 @@
{
"LIT001": {
- "limit": 22741
+ "limit": 22733
},
"LIT002": {
- "limit": 26865
+ "limit": 26864
},
"LIT003": {
"limit": 269
@@ -27,7 +27,7 @@
"limit": 0
},
"LIT010": {
- "limit": 16638
+ "limit": 16621
},
"LIT011": {
"limit": 5585