diff --git a/litellm/integrations/prometheus.py b/litellm/integrations/prometheus.py index bfb7ade372e..c8f5a303770 100644 --- a/litellm/integrations/prometheus.py +++ b/litellm/integrations/prometheus.py @@ -943,10 +943,10 @@ class PrometheusLogger(CustomLogger): else: _tags = [] - print_verbose( - "inside track_prometheus_metrics, model %s, response_cost %s, tokens_used %s" - % (model, response_cost, tokens_used) - ) + if litellm.set_verbose: + print_verbose( + f"inside track_prometheus_metrics, model {model}, response_cost {response_cost}, tokens_used {tokens_used}" + ) enum_values = UserAPIKeyLabelValues( end_user=end_user_id, diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index c6013c450b1..69dc0175585 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -56,7 +56,14 @@ except Exception: @functools.lru_cache(maxsize=64) def _parse_url(url: str) -> httpx.URL: """Pre-parse a URL string into an httpx.URL to avoid regex-heavy - parsing inside httpx._merge_url on every request (~7μs → ~0.4μs).""" + parsing inside httpx._merge_url on every request (~7μs → ~0.4μs). + + Safe to use with ``build_request(params=...)``: httpx replaces the + query string entirely when ``params`` is non-None, so any query + params baked into the cached URL are harmless in that case. When + ``params`` is None the cached URL preserves the original query + string, which is the correct behaviour. + """ return httpx.URL(url)