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]

Prometheus - make OSS (#16689)

Krish Dholakia586f126395e2
diff --git a/docs/my-website/docs/enterprise.md b/docs/my-website/docs/enterprise.md
index cc3466fc103..6bcfed24c94 100644
--- a/docs/my-website/docs/enterprise.md
+++ b/docs/my-website/docs/enterprise.md
@@ -16,7 +16,7 @@ Get free 7-day trial key [here](https://www.litellm.ai/enterprise#trial)
Includes all enterprise features.
-<Image img={require('../img/enterprise_vs_oss.png')} />
+<Image img={require('../img/enterprise_vs_oss_2.png')} />
[**Procurement available via AWS / Azure Marketplace**](./data_security.md#legalcompliance-faqs)
@@ -40,7 +40,7 @@ Self-Managed Enterprise deployments require our team to understand your exact ne
### How does deployment with Enterprise License work?
-You just deploy [our docker image](https://docs.litellm.ai/docs/proxy/deploy) and get an enterprise license key to add to your environment to unlock additional functionality (SSO, Prometheus metrics, etc.).
+You just deploy [our docker image](https://docs.litellm.ai/docs/proxy/deploy) and get an enterprise license key to add to your environment to unlock additional functionality (SSO, etc.).
```env
LITELLM_LICENSE="eyJ..."
diff --git a/docs/my-website/docs/proxy/enterprise.md b/docs/my-website/docs/proxy/enterprise.md
index 42677264ff6..b5d8ab59077 100644
--- a/docs/my-website/docs/proxy/enterprise.md
+++ b/docs/my-website/docs/proxy/enterprise.md
@@ -32,13 +32,9 @@ Features:
- ✅ [Set Model budgets for Virtual Keys](./users#-virtual-key-model-specific)
- ✅ [Exporting LLM Logs to GCS Bucket, Azure Blob Storage](./proxy/bucket#🪣-logging-gcs-s3-buckets)
- ✅ [`/spend/report` API endpoint](cost_tracking.md#✨-enterprise-api-endpoints-to-get-spend)
-- **Prometheus Metrics**
- - ✅ [Prometheus Metrics - Num Requests, failures, LLM Provider Outages](prometheus)
- - ✅ [`x-ratelimit-remaining-requests`, `x-ratelimit-remaining-tokens` for LLM APIs on Prometheus](prometheus#✨-enterprise-llm-remaining-requests-and-remaining-tokens)
-- **Control Guardrails per API Key**
+- **Control Guardrails per API Key/Team**
- **Custom Branding**
- ✅ [Custom Branding + Routes on Swagger Docs](#swagger-docs---custom-routes--branding)
- - ✅ [Public Model Hub](#public-model-hub)
- ✅ [Custom Email Branding](./email.md#customizing-email-branding)
diff --git a/docs/my-website/docs/proxy/prometheus.md b/docs/my-website/docs/proxy/prometheus.md
index 283076195e2..370a6540f9c 100644
--- a/docs/my-website/docs/proxy/prometheus.md
+++ b/docs/my-website/docs/proxy/prometheus.md
@@ -4,15 +4,6 @@ import Image from '@theme/IdealImage';
# 📈 Prometheus metrics
-:::info
-
-✨ Prometheus metrics is on LiteLLM Enterprise
-
-[Enterprise Pricing](https://www.litellm.ai/#pricing)
-
-[Get free 7-day trial key](https://www.litellm.ai/enterprise#trial)
-
-:::
LiteLLM Exposes a `/metrics` endpoint for Prometheus to Poll
diff --git a/docs/my-website/img/enterprise_vs_oss.png b/docs/my-website/img/enterprise_vs_oss.png
deleted file mode 100644
index 2b88bdd33ef..00000000000
Binary files a/docs/my-website/img/enterprise_vs_oss.png and /dev/null differ
diff --git a/docs/my-website/img/enterprise_vs_oss_2.png b/docs/my-website/img/enterprise_vs_oss_2.png
new file mode 100644
index 00000000000..62ca1cded57
Binary files /dev/null and b/docs/my-website/img/enterprise_vs_oss_2.png differ
diff --git a/enterprise/dist/litellm_enterprise-0.1.21-py3-none-any.whl b/enterprise/dist/litellm_enterprise-0.1.21-py3-none-any.whl
new file mode 100644
index 00000000000..6452930c9f0
Binary files /dev/null and b/enterprise/dist/litellm_enterprise-0.1.21-py3-none-any.whl differ
diff --git a/enterprise/dist/litellm_enterprise-0.1.21.tar.gz b/enterprise/dist/litellm_enterprise-0.1.21.tar.gz
new file mode 100644
index 00000000000..ed6ebc3834e
Binary files /dev/null and b/enterprise/dist/litellm_enterprise-0.1.21.tar.gz differ
diff --git a/enterprise/pyproject.toml b/enterprise/pyproject.toml
index 1d1fa64549c..aec888ddc94 100644
--- a/enterprise/pyproject.toml
+++ b/enterprise/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "litellm-enterprise"
-version = "0.1.20"
+version = "0.1.21"
description = "Package for LiteLLM Enterprise features"
authors = ["BerriAI"]
readme = "README.md"
@@ -22,7 +22,7 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.commitizen]
-version = "0.1.20"
+version = "0.1.21"
version_files = [
"pyproject.toml:version",
"../requirements.txt:litellm-enterprise==",
diff --git a/enterprise/litellm_enterprise/integrations/prometheus.py b/litellm/integrations/prometheus.py
similarity index 98%
rename from enterprise/litellm_enterprise/integrations/prometheus.py
rename to litellm/integrations/prometheus.py
index 57db14fec40..8186006f8c8 100644
--- a/enterprise/litellm_enterprise/integrations/prometheus.py
+++ b/litellm/integrations/prometheus.py
@@ -41,21 +41,9 @@ class PrometheusLogger(CustomLogger):
try:
from prometheus_client import Counter, Gauge, Histogram
- from litellm.proxy.proxy_server import CommonProxyErrors, premium_user
-
# Always initialize label_filters, even for non-premium users
self.label_filters = self._parse_prometheus_config()
- if premium_user is not True:
- verbose_logger.warning(
- f"🚨🚨🚨 Prometheus Metrics is on LiteLLM Enterprise\n🚨 {CommonProxyErrors.not_premium_user.value}"
- )
- self.litellm_not_a_premium_user_metric = Counter(
- name="litellm_not_a_premium_user_metric",
- documentation=f"🚨🚨🚨 Prometheus Metrics is on LiteLLM Enterprise. 🚨 {CommonProxyErrors.not_premium_user.value}",
- )
- return
-
# Create metric factory functions
self._counter_factory = self._create_metric_factory(Counter)
self._gauge_factory = self._create_metric_factory(Gauge)
@@ -2184,9 +2172,6 @@ class PrometheusLogger(CustomLogger):
It emits the current remaining budget metrics for all Keys and Teams.
"""
- from enterprise.litellm_enterprise.integrations.prometheus import (
- PrometheusLogger,
- )
from litellm.constants import PROMETHEUS_BUDGET_METRICS_REFRESH_INTERVAL_MINUTES
from litellm.integrations.custom_logger import CustomLogger
@@ -2213,26 +2198,19 @@ class PrometheusLogger(CustomLogger):
)
@staticmethod
- def _mount_metrics_endpoint(premium_user: bool):
+ def _mount_metrics_endpoint():
"""
Mount the Prometheus metrics endpoint with optional authentication.
Args:
- premium_user (bool): Whether the user is a premium user
require_auth (bool, optional): Whether to require authentication for the metrics endpoint.
Defaults to False.
"""
from prometheus_client import make_asgi_app
from litellm._logging import verbose_proxy_logger
- from litellm.proxy._types import CommonProxyErrors
from litellm.proxy.proxy_server import app
- if premium_user is not True:
- verbose_proxy_logger.warning(
- f"Prometheus metrics are only available for premium users. {CommonProxyErrors.not_premium_user.value}"
- )
-
# Create metrics ASGI app
if "PROMETHEUS_MULTIPROC_DIR" in os.environ:
from prometheus_client import CollectorRegistry, multiprocess
diff --git a/litellm/litellm_core_utils/custom_logger_registry.py b/litellm/litellm_core_utils/custom_logger_registry.py
index 09794bf2677..80f2f195839 100644
--- a/litellm/litellm_core_utils/custom_logger_registry.py
+++ b/litellm/litellm_core_utils/custom_logger_registry.py
@@ -16,14 +16,16 @@ from litellm.integrations.anthropic_cache_control_hook import AnthropicCacheCont
from litellm.integrations.argilla import ArgillaLogger
from litellm.integrations.azure_storage.azure_storage import AzureBlobStorageLogger
from litellm.integrations.bitbucket import BitBucketPromptManager
-from litellm.integrations.gitlab import GitLabPromptManager
from litellm.integrations.braintrust_logging import BraintrustLogger
+from litellm.integrations.cloudzero.cloudzero import CloudZeroLogger
from litellm.integrations.datadog.datadog import DataDogLogger
from litellm.integrations.datadog.datadog_llm_obs import DataDogLLMObsLogger
from litellm.integrations.deepeval import DeepEvalLogger
+from litellm.integrations.dotprompt import DotpromptManager
from litellm.integrations.galileo import GalileoObserve
from litellm.integrations.gcs_bucket.gcs_bucket import GCSBucketLogger
from litellm.integrations.gcs_pubsub.pub_sub import GcsPubSubLogger
+from litellm.integrations.gitlab import GitLabPromptManager
from litellm.integrations.humanloop import HumanloopLogger
from litellm.integrations.lago import LagoLogger
from litellm.integrations.langfuse.langfuse_prompt_management import (
@@ -36,13 +38,7 @@ from litellm.integrations.openmeter import OpenMeterLogger
from litellm.integrations.opentelemetry import OpenTelemetry
from litellm.integrations.opik.opik import OpikLogger
from litellm.integrations.posthog import PostHogLogger
-
-try:
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
-except Exception:
- PrometheusLogger = None
-from litellm.integrations.cloudzero.cloudzero import CloudZeroLogger
-from litellm.integrations.dotprompt import DotpromptManager
+from litellm.integrations.prometheus import PrometheusLogger
from litellm.integrations.s3_v2 import S3Logger
from litellm.integrations.sqs import SQSLogger
from litellm.integrations.vector_store_integrations.vector_store_pre_call_hook import (
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index 41a5eed55d8..6bad7ee29e2 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -58,6 +58,7 @@ from litellm.integrations.custom_guardrail import CustomGuardrail
from litellm.integrations.custom_logger import CustomLogger
from litellm.integrations.deepeval.deepeval import DeepEvalLogger
from litellm.integrations.mlflow import MlflowLogger
+from litellm.integrations.prometheus import PrometheusLogger
from litellm.integrations.sqs import SQSLogger
from litellm.litellm_core_utils.get_litellm_params import get_litellm_params
from litellm.litellm_core_utils.llm_cost_calc.tool_call_cost_tracking import (
@@ -176,7 +177,6 @@ try:
from litellm_enterprise.enterprise_callbacks.send_emails.smtp_email import (
SMTPEmailLogger,
)
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
from litellm_enterprise.litellm_core_utils.litellm_logging import (
StandardLoggingPayloadSetup as EnterpriseStandardLoggingPayloadSetup,
)
@@ -194,7 +194,6 @@ except Exception as e:
PagerDutyAlerting = CustomLogger # type: ignore
EnterpriseCallbackControls = None # type: ignore
EnterpriseStandardLoggingPayloadSetupVAR = None
- PrometheusLogger = None
_in_memory_loggers: List[Any] = []
### GLOBAL VARIABLES ###
@@ -1475,33 +1474,58 @@ class Logging(LiteLLMLoggingBaseClass):
if self.model_call_details["litellm_params"]["metadata"] is None:
self.model_call_details["litellm_params"]["metadata"] = {}
self.model_call_details["litellm_params"]["metadata"]["hidden_params"] = getattr(logging_result, "_hidden_params", {}) # type: ignore
-
+
if "response_cost" in hidden_params:
self.model_call_details["response_cost"] = hidden_params["response_cost"]
else:
- self.model_call_details["response_cost"] = self._response_cost_calculator(result=logging_result)
-
- self.model_call_details["standard_logging_object"] = get_standard_logging_object_payload(
- kwargs=self.model_call_details,
- init_response_obj=logging_result,
- start_time=start_time,
- end_time=end_time,
- logging_obj=self,
- status="success",
- standard_built_in_tools_params=self.standard_built_in_tools_params,
+ self.model_call_details["response_cost"] = self._response_cost_calculator(
+ result=logging_result
+ )
+
+ self.model_call_details["standard_logging_object"] = (
+ get_standard_logging_object_payload(
+ kwargs=self.model_call_details,
+ init_response_obj=logging_result,
+ start_time=start_time,
+ end_time=end_time,
+ logging_obj=self,
+ status="success",
+ standard_built_in_tools_params=self.standard_built_in_tools_params,
+ )
)
def _transform_usage_objects(self, result):
if isinstance(result, ResponsesAPIResponse):
result = result.model_copy()
- transformed_usage = ResponseAPILoggingUtils._transform_response_api_usage_to_chat_usage(result.usage)
- setattr(result, "usage", transformed_usage.model_dump() if hasattr(transformed_usage, "model_dump") else dict(transformed_usage))
- if (standard_logging_payload := self.model_call_details.get("standard_logging_object")) is not None:
- standard_logging_payload["response"] = result.model_dump() if hasattr(result, "model_dump") else dict(result)
+ transformed_usage = (
+ ResponseAPILoggingUtils._transform_response_api_usage_to_chat_usage(
+ result.usage
+ )
+ )
+ setattr(
+ result,
+ "usage",
+ (
+ transformed_usage.model_dump()
+ if hasattr(transformed_usage, "model_dump")
+ else dict(transformed_usage)
+ ),
+ )
+ if (
+ standard_logging_payload := self.model_call_details.get(
+ "standard_logging_object"
+ )
+ ) is not None:
+ standard_logging_payload["response"] = (
+ result.model_dump()
+ if hasattr(result, "model_dump")
+ else dict(result)
+ )
elif isinstance(result, TranscriptionResponse):
from litellm.litellm_core_utils.llm_cost_calc.usage_object_transformation import (
TranscriptionUsageObjectTransformation,
)
+
result = result.model_copy()
transformed_usage = TranscriptionUsageObjectTransformation.transform_transcription_usage_object(result.usage) # type: ignore
setattr(result, "usage", transformed_usage)
@@ -1522,40 +1546,67 @@ class Logging(LiteLLMLoggingBaseClass):
end_time = datetime.datetime.now()
if self.completion_start_time is None:
self.completion_start_time = end_time
- self.model_call_details["completion_start_time"] = self.completion_start_time
-
+ self.model_call_details["completion_start_time"] = (
+ self.completion_start_time
+ )
+
self.model_call_details["log_event_type"] = "successful_api_call"
self.model_call_details["end_time"] = end_time
self.model_call_details["cache_hit"] = cache_hit
-
+
if self.call_type == CallTypes.anthropic_messages.value:
result = self._handle_anthropic_messages_response_logging(result=result)
- elif self.call_type == CallTypes.generate_content.value or self.call_type == CallTypes.agenerate_content.value:
- result = self._handle_non_streaming_google_genai_generate_content_response_logging(result=result)
-
+ elif (
+ self.call_type == CallTypes.generate_content.value
+ or self.call_type == CallTypes.agenerate_content.value
+ ):
+ result = self._handle_non_streaming_google_genai_generate_content_response_logging(
+ result=result
+ )
+
logging_result = self.normalize_logging_result(result=result)
- if standard_logging_object is None and result is not None and self.stream is not True:
- if self._is_recognized_call_type_for_logging(logging_result=logging_result):
- self._process_hidden_params_and_response_cost(logging_result=logging_result, start_time=start_time, end_time=end_time)
- elif isinstance(result, dict) or isinstance(result, list):
- self.model_call_details["standard_logging_object"] = get_standard_logging_object_payload(
- kwargs=self.model_call_details,
- init_response_obj=result,
+ if (
+ standard_logging_object is None
+ and result is not None
+ and self.stream is not True
+ ):
+ if self._is_recognized_call_type_for_logging(
+ logging_result=logging_result
+ ):
+ self._process_hidden_params_and_response_cost(
+ logging_result=logging_result,
start_time=start_time,
end_time=end_time,
- logging_obj=self,
- status="success",
- standard_built_in_tools_params=self.standard_built_in_tools_params,
+ )
+ elif isinstance(result, dict) or isinstance(result, list):
+ self.model_call_details["standard_logging_object"] = (
+ get_standard_logging_object_payload(
+ kwargs=self.model_call_details,
+ init_response_obj=result,
+ start_time=start_time,
+ end_time=end_time,
+ logging_obj=self,
+ status="success",
+ standard_built_in_tools_params=self.standard_built_in_tools_params,
+ )
)
elif standard_logging_object is not None:
- self.model_call_details["standard_logging_object"] = standard_logging_object
+ self.model_call_details["standard_logging_object"] = (
+ standard_logging_object
+ )
else:
self.model_call_details["response_cost"] = None
result = self._transform_usage_objects(result=result)
-
- if litellm.max_budget and self.stream is False and result is not None and isinstance(result, dict) and "content" in result:
+
+ if (
+ litellm.max_budget
+ and self.stream is False
+ and result is not None
+ and isinstance(result, dict)
+ and "content" in result
+ ):
time_diff = (end_time - start_time).total_seconds()
float_diff = float(time_diff)
litellm._current_cost += litellm.completion_cost(
@@ -3340,8 +3391,6 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915
_in_memory_loggers.append(_literalai_logger)
return _literalai_logger # type: ignore
elif logging_integration == "prometheus":
- if PrometheusLogger is None:
- raise ValueError("PrometheusLogger is not initialized")
for callback in _in_memory_loggers:
if isinstance(callback, PrometheusLogger):
return callback # type: ignore
diff --git a/litellm/proxy/_experimental/out/api-reference.html b/litellm/proxy/_experimental/out/api-reference/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/api-reference.html
rename to litellm/proxy/_experimental/out/api-reference/index.html
diff --git a/litellm/proxy/_experimental/out/guardrails.html b/litellm/proxy/_experimental/out/guardrails.html
deleted file mode 100644
index 0ac9e1c71ea..00000000000
--- a/litellm/proxy/_experimental/out/guardrails.html
+++ /dev/null
@@ -1 +0,0 @@
-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-64e84c4092e0c5d7.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/2117-2da5ec8fad6a6c25.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-c6945ec5b2d5e671.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/d1d84bbc374a5a03.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[49514,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-80dbf1ebc561e9b6.js\",\"4556\",\"static/chunks/4556-6a2e7184dcc130ca.js\",\"2417\",\"static/chunks/2417-de54467906071c72.js\",\"2926\",\"static/chunks/2926-b5dcad9f62f5e2b1.js\",\"1529\",\"static/chunks/1529-130888c02463f3dd.js\",\"3709\",\"static/chunks/3709-b17db86e0ab325d2.js\",\"2409\",\"static/chunks/2409-33ed6e753f8afe9b.js\",\"2525\",\"static/chunks/2525-5d3265de892ef666.js\",\"3603\",\"static/chunks/3603-dd19ac8e31e4bc25.js\",\"2284\",\"static/chunks/2284-6840f6cabd9dbd7e.js\",\"7908\",\"static/chunks/7908-07a76cfe29c543c9.js\",\"9011\",\"static/chunks/9011-0769cb78a6e5f233.js\",\"5319\",\"static/chunks/5319-43bd4ee5bb7e50d1.js\",\"7519\",\"static/chunks/7519-c017e0c3b119c340.js\",\"8077\",\"static/chunks/8077-dca1854790bc2151.js\",\"169\",\"static/chunks/169-07530b6fecd36167.js\",\"3655\",\"static/chunks/3655-7dee4252a2b35874.js\",\"8049\",\"static/chunks/8049-db73a2d52dc11ceb.js\",\"6478\",\"static/chunks/6478-f5fd91a406dd265e.js\",\"6607\",\"static/chunks/app/(dashboard)/guardrails/page-93dbf37f5765488e.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\na:I[89219,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-80dbf1ebc561e9b6.js\",\"4556\",\"static/chunks/4556-6a2e7184dcc130ca.js\",\"1529\",\"static/chunks/1529-130888c02463f3dd.js\",\"3709\",\"static/chunks/3709-b17db86e0ab325d2.js\",\"3603\",\"static/chunks/3603-dd19ac8e31e4bc25.js\",\"9165\",\"static/chunks/9165-2a738a73d0d5f1d1.js\",\"8098\",\"static/chunks/8098-3da3212991542668.js\",\"8049\",\"static/chunks/8049-db73a2d52dc11ceb.js\",\"2019\",\"static/chunks/2019-02887e9caea1e319.js\",\"5642\",\"static/chunks/app/(dashboard)/layout-e6c01f120876bb3b.js\"],\"default\",1]\nc:I[31857,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-80dbf1ebc561e9b6.js\",\"8049\",\"static/chunks/8049-db73a2d52dc11ceb.js\",\"3185\",\"static/chunks/app/layout-820cedabc8a0fb7a.js\"],\"FeatureFlagsProvider\"]\n12:I[61060,[],\"\"]\nb:{}\nd:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple"])</script><script>self.__next_f.push([1," Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\ne:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\nf:{\"display\":\"inline-block\"}\n10:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\n13:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"zzKcMfj4Db-ZZ7hcspdhR\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"guardrails\"],\"initialTree\":[\"\",{\"children\":[\"(dashboard)\",{\"children\":[\"guardrails\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"(dashboard)\",{\"children\":[\"guardrails\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"(dashboard)\",\"children\",\"guardrails\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[null,[\"$\",\"$La\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"(dashboard)\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}],\"params\":\"$b\"}]],null],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/d1d84bbc374a5a03.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$d\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$e\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$f\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$10\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$L11\"],\"globalErrorComponent\":\"$12\",\"missingSlots\":\"$W13\"}]\n"])</script><script>self.__next_f.push([1,"11:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/logs.html b/litellm/proxy/_experimental/out/logs/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/logs.html
rename to litellm/proxy/_experimental/out/logs/index.html
diff --git a/litellm/proxy/_experimental/out/model-hub.html b/litellm/proxy/_experimental/out/model-hub/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/model-hub.html
rename to litellm/proxy/_experimental/out/model-hub/index.html
diff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/model_hub_table.html
rename to litellm/proxy/_experimental/out/model_hub_table/index.html
diff --git a/litellm/proxy/_experimental/out/models-and-endpoints.html b/litellm/proxy/_experimental/out/models-and-endpoints/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/models-and-endpoints.html
rename to litellm/proxy/_experimental/out/models-and-endpoints/index.html
diff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.html
deleted file mode 100644
index 712474956a7..00000000000
--- a/litellm/proxy/_experimental/out/onboarding.html
+++ /dev/null
@@ -1 +0,0 @@
-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-64e84c4092e0c5d7.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/2117-2da5ec8fad6a6c25.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-c6945ec5b2d5e671.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/d1d84bbc374a5a03.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[12011,[\"3665\",\"static/chunks/3014691f-702e24806fe9cec4.js\",\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-80dbf1ebc561e9b6.js\",\"4556\",\"static/chunks/4556-6a2e7184dcc130ca.js\",\"8806\",\"static/chunks/8806-3db5b9008c4f8124.js\",\"8049\",\"static/chunks/8049-db73a2d52dc11ceb.js\",\"8461\",\"static/chunks/app/onboarding/page-9d2237541bf5adf9.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\na:I[31857,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-80dbf1ebc561e9b6.js\",\"8049\",\"static/chunks/8049-db73a2d52dc11ceb.js\",\"3185\",\"static/chunks/app/layout-820cedabc8a0fb7a.js\"],\"FeatureFlagsProvider\"]\nc:I[61060,[],\"\"]\nd:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"zzKcMfj4Db-ZZ7hcspdhR\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"onboarding\"],\"initialTree\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"onboarding\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/d1d84bbc374a5a03.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$Lb\"],\"globalErrorComponent\":\"$c\",\"missingSlots\":\"$Wd\"}]\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/organizations.html b/litellm/proxy/_experimental/out/organizations/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/organizations.html
rename to litellm/proxy/_experimental/out/organizations/index.html
diff --git a/litellm/proxy/_experimental/out/teams.html b/litellm/proxy/_experimental/out/teams/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/teams.html
rename to litellm/proxy/_experimental/out/teams/index.html
diff --git a/litellm/proxy/_experimental/out/test-key.html b/litellm/proxy/_experimental/out/test-key/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/test-key.html
rename to litellm/proxy/_experimental/out/test-key/index.html
diff --git a/litellm/proxy/_experimental/out/usage.html b/litellm/proxy/_experimental/out/usage/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/usage.html
rename to litellm/proxy/_experimental/out/usage/index.html
diff --git a/litellm/proxy/_experimental/out/users.html b/litellm/proxy/_experimental/out/users/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/users.html
rename to litellm/proxy/_experimental/out/users/index.html
diff --git a/litellm/proxy/_experimental/out/virtual-keys.html b/litellm/proxy/_experimental/out/virtual-keys/index.html
similarity index 100%
rename from litellm/proxy/_experimental/out/virtual-keys.html
rename to litellm/proxy/_experimental/out/virtual-keys/index.html
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index 89a5e01b169..20d5cc53c50 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -31,4 +31,7 @@ agent_list:
examples: ['hi', 'hello world']
supportsAuthenticatedExtendedCard: true
litellm_params:
- make_public: true
\ No newline at end of file
+ make_public: true
+
+litellm_settings:
+ callbacks: ["prometheus"]
\ No newline at end of file
diff --git a/litellm/proxy/common_utils/callback_utils.py b/litellm/proxy/common_utils/callback_utils.py
index 4373f84292c..7cd359f7ce0 100644
--- a/litellm/proxy/common_utils/callback_utils.py
+++ b/litellm/proxy/common_utils/callback_utils.py
@@ -1,4 +1,4 @@
-from typing import Any, Dict, List, Literal, Optional, Iterable
+from typing import Any, Dict, Iterable, List, Literal, Optional
import litellm
from litellm import get_secret
@@ -268,13 +268,9 @@ def initialize_callbacks_on_proxy( # noqa: PLR0915
litellm.callbacks = imported_list # type: ignore
if "prometheus" in value:
- try:
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
- except Exception:
- PrometheusLogger = None
+ from litellm.integrations.prometheus import PrometheusLogger
- if PrometheusLogger:
- PrometheusLogger._mount_metrics_endpoint(premium_user)
+ PrometheusLogger._mount_metrics_endpoint()
else:
litellm.callbacks = [
get_instance_fn(
@@ -289,7 +285,9 @@ def initialize_callbacks_on_proxy( # noqa: PLR0915
def get_model_group_from_litellm_kwargs(kwargs: dict) -> Optional[str]:
_litellm_params = kwargs.get("litellm_params", None) or {}
- _metadata = _litellm_params.get(get_metadata_variable_name_from_kwargs(kwargs)) or {}
+ _metadata = (
+ _litellm_params.get(get_metadata_variable_name_from_kwargs(kwargs)) or {}
+ )
_model_group = _metadata.get("model_group", None)
if _model_group is not None:
return _model_group
@@ -368,22 +366,23 @@ def add_guardrail_to_applied_guardrails_header(
def get_metadata_variable_name_from_kwargs(
- kwargs: dict
- ) -> Literal["metadata", "litellm_metadata"]:
- """
- Helper to return what the "metadata" field should be called in the request data
+ kwargs: dict,
+) -> Literal["metadata", "litellm_metadata"]:
+ """
+ Helper to return what the "metadata" field should be called in the request data
- - New endpoints return `litellm_metadata`
- - Old endpoints return `metadata`
+ - New endpoints return `litellm_metadata`
+ - Old endpoints return `metadata`
+
+ Context:
+ - LiteLLM used `metadata` as an internal field for storing metadata
+ - OpenAI then started using this field for their metadata
+ - LiteLLM is now moving to using `litellm_metadata` for our metadata
+ """
+ return "litellm_metadata" if "litellm_metadata" in kwargs else "metadata"
- Context:
- - LiteLLM used `metadata` as an internal field for storing metadata
- - OpenAI then started using this field for their metadata
- - LiteLLM is now moving to using `litellm_metadata` for our metadata
- """
- return "litellm_metadata" if "litellm_metadata" in kwargs else "metadata"
def normalize_callback_names(callbacks: Iterable[Any]) -> List[Any]:
if callbacks is None:
return []
- return [c.lower() if isinstance(c, str) else c for c in callbacks]
\ No newline at end of file
+ return [c.lower() if isinstance(c, str) else c for c in callbacks]
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 226b5c11795..10f75185564 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -285,6 +285,9 @@ from litellm.proxy.management_endpoints.key_management_endpoints import (
from litellm.proxy.management_endpoints.mcp_management_endpoints import (
router as mcp_management_router,
)
+from litellm.proxy.management_endpoints.model_access_group_management_endpoints import (
+ router as model_access_group_management_router,
+)
from litellm.proxy.management_endpoints.model_management_endpoints import (
_add_model_to_db,
_add_team_model_to_db,
@@ -293,9 +296,6 @@ from litellm.proxy.management_endpoints.model_management_endpoints import (
from litellm.proxy.management_endpoints.model_management_endpoints import (
router as model_management_router,
)
-from litellm.proxy.management_endpoints.model_access_group_management_endpoints import (
- router as model_access_group_management_router,
-)
from litellm.proxy.management_endpoints.organization_endpoints import (
router as organization_router,
)
@@ -2230,20 +2230,15 @@ class ProxyConfig:
callback
)
if "prometheus" in callback:
- try:
- from litellm_enterprise.integrations.prometheus import (
- PrometheusLogger,
- )
- except Exception:
- PrometheusLogger = None
+ from litellm.integrations.prometheus import (
+ PrometheusLogger,
+ )
if PrometheusLogger is not None:
verbose_proxy_logger.debug(
"mounting metrics endpoint"
)
- PrometheusLogger._mount_metrics_endpoint(
- premium_user
- )
+ PrometheusLogger._mount_metrics_endpoint()
print( # noqa
f"{blue_color_code} Initialized Success Callbacks - {litellm.success_callback} {reset_color_code}"
) # noqa
@@ -4492,13 +4487,9 @@ class ProxyStartupEvent:
# Prometheus Background Job
########################################################
if litellm.prometheus_initialize_budget_metrics is True:
- try:
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
-
- PrometheusLogger.initialize_budget_metrics_cron_job(scheduler=scheduler)
- except Exception:
- PrometheusLogger = None
+ from litellm.integrations.prometheus import PrometheusLogger
+ PrometheusLogger.initialize_budget_metrics_cron_job(scheduler=scheduler)
########################################################
# Key Rotation Background Job
########################################################
@@ -5065,14 +5056,12 @@ async def embeddings( # noqa: PLR0915
# Use router's O(1) lookup instead of O(N) iteration through llm_model_list
deployment = llm_router.get_deployment(model_id=data["model"])
if deployment is not None:
- litellm_model = deployment.get("litellm_params", {}).get("model", "")
+ litellm_params = deployment.get("litellm_params", {}) or {}
+ litellm_model = litellm_params.get("model", "")
# Check if this provider supports token arrays
- supports_token_arrays = (
- litellm_model in litellm.open_ai_embedding_models
- or any(
- litellm_model.startswith(provider)
- for provider in LITELLM_EMBEDDING_PROVIDERS_SUPPORTING_INPUT_ARRAY_OF_TOKENS
- )
+ supports_token_arrays = litellm_model in litellm.open_ai_embedding_models or any(
+ litellm_model.startswith(provider)
+ for provider in LITELLM_EMBEDDING_PROVIDERS_SUPPORTING_INPUT_ARRAY_OF_TOKENS
)
if not supports_token_arrays:
# non-openai/azure embedding model called with token input - decode tokens
@@ -5085,7 +5074,7 @@ async def embeddings( # noqa: PLR0915
# Use unified request processor (same as chat/completions and responses)
base_llm_response_processor = ProxyBaseLLMRequestProcessing(data=data)
-
+
# Process the request with all optimizations (shared sessions, network tuning, etc.)
response = await base_llm_response_processor.base_process_llm_request(
request=request,
@@ -5105,7 +5094,7 @@ async def embeddings( # noqa: PLR0915
user_api_base=user_api_base,
version=version,
)
-
+
return response
except Exception as e:
# Use unified error handler
diff --git a/litellm/router_utils/cooldown_callbacks.py b/litellm/router_utils/cooldown_callbacks.py
index 522cd3e2656..343328dacf3 100644
--- a/litellm/router_utils/cooldown_callbacks.py
+++ b/litellm/router_utils/cooldown_callbacks.py
@@ -12,10 +12,7 @@ if TYPE_CHECKING:
from litellm.router import Router as _Router
LitellmRouter = _Router
- try:
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
- except Exception:
- PrometheusLogger = None
+ from litellm.integrations.prometheus import PrometheusLogger
else:
LitellmRouter = Any
PrometheusLogger = Any
@@ -62,9 +59,9 @@ async def router_cooldown_event_callback(
pass
# get the prometheus logger from in memory loggers
- prometheusLogger: Optional[
- PrometheusLogger
- ] = _get_prometheus_logger_from_callbacks()
+ prometheusLogger: Optional[PrometheusLogger] = (
+ _get_prometheus_logger_from_callbacks()
+ )
if prometheusLogger is not None:
prometheusLogger.set_deployment_complete_outage(
@@ -89,10 +86,7 @@ def _get_prometheus_logger_from_callbacks() -> Optional[PrometheusLogger]:
"""
Checks if prometheus is a initalized callback, if yes returns it
"""
- try:
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
- except Exception:
- PrometheusLogger = None
+ from litellm.integrations.prometheus import PrometheusLogger
if PrometheusLogger is None:
return None
diff --git a/poetry.lock b/poetry.lock
index de6355538d0..5d15b24cbc5 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -598,109 +598,10 @@ files = [
{file = "cffi-1.17.1-cp39-cp39-win_amd64.whl", hash = "sha256:d016c76bdd850f3c626af19b0542c9677ba156e4ee4fccfdd7848803533ef662"},
{file = "cffi-1.17.1.tar.gz", hash = "sha256:1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824"},
]
-markers = {main = "(platform_python_implementation != \"PyPy\" or extra == \"proxy\") and python_version < \"3.10\"", dev = "python_version < \"3.10\" and platform_python_implementation != \"PyPy\"", proxy-dev = "python_version < \"3.10\" and platform_python_implementation != \"PyPy\""}
[package.dependencies]
pycparser = "*"
-[[package]]
-name = "cffi"
-version = "2.0.0"
-description = "Foreign Function Interface for Python calling C code."
-optional = false
-python-versions = ">=3.9"
-groups = ["main", "dev", "proxy-dev"]
-files = [
- {file = "cffi-2.0.0-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:0cf2d91ecc3fcc0625c2c530fe004f82c110405f101548512cce44322fa8ac44"},
- {file = "cffi-2.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f73b96c41e3b2adedc34a7356e64c8eb96e03a3782b535e043a986276ce12a49"},
- {file = "cffi-2.0.0-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:53f77cbe57044e88bbd5ed26ac1d0514d2acf0591dd6bb02a3ae37f76811b80c"},
- {file = "cffi-2.0.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3e837e369566884707ddaf85fc1744b47575005c0a229de3327f8f9a20f4efeb"},
- {file = "cffi-2.0.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:5eda85d6d1879e692d546a078b44251cdd08dd1cfb98dfb77b670c97cee49ea0"},
- {file = "cffi-2.0.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:9332088d75dc3241c702d852d4671613136d90fa6881da7d770a483fd05248b4"},
- {file = "cffi-2.0.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fc7de24befaeae77ba923797c7c87834c73648a05a4bde34b3b7e5588973a453"},
- {file = "cffi-2.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:cf364028c016c03078a23b503f02058f1814320a56ad535686f90565636a9495"},
- {file = "cffi-2.0.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e11e82b744887154b182fd3e7e8512418446501191994dbf9c9fc1f32cc8efd5"},
- {file = "cffi-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8ea985900c5c95ce9db1745f7933eeef5d314f0565b27625d9a10ec9881e1bfb"},
- {file = "cffi-2.0.0-cp310-cp310-win32.whl", hash = "sha256:1f72fb8906754ac8a2cc3f9f5aaa298070652a0ffae577e0ea9bd480dc3c931a"},
- {file = "cffi-2.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:b18a3ed7d5b3bd8d9ef7a8cb226502c6bf8308df1525e1cc676c3680e7176739"},
- {file = "cffi-2.0.0-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:b4c854ef3adc177950a8dfc81a86f5115d2abd545751a304c5bcf2c2c7283cfe"},
- {file = "cffi-2.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2de9a304e27f7596cd03d16f1b7c72219bd944e99cc52b84d0145aefb07cbd3c"},
- {file = "cffi-2.0.0-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:baf5215e0ab74c16e2dd324e8ec067ef59e41125d3eade2b863d294fd5035c92"},
- {file = "cffi-2.0.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:730cacb21e1bdff3ce90babf007d0a0917cc3e6492f336c2f0134101e0944f93"},
- {file = "cffi-2.0.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:6824f87845e3396029f3820c206e459ccc91760e8fa24422f8b0c3d1731cbec5"},
- {file = "cffi-2.0.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:9de40a7b0323d889cf8d23d1ef214f565ab154443c42737dfe52ff82cf857664"},
- {file = "cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8941aaadaf67246224cee8c3803777eed332a19d909b47e29c9842ef1e79ac26"},
- {file = "cffi-2.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:a05d0c237b3349096d3981b727493e22147f934b20f6f125a3eba8f994bec4a9"},
- {file = "cffi-2.0.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:94698a9c5f91f9d138526b48fe26a199609544591f859c870d477351dc7b2414"},
- {file = "cffi-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:5fed36fccc0612a53f1d4d9a816b50a36702c28a2aa880cb8a122b3466638743"},
- {file = "cffi-2.0.0-cp311-cp311-win32.whl", hash = "sha256:c649e3a33450ec82378822b3dad03cc228b8f5963c0c12fc3b1e0ab940f768a5"},
- {file = "cffi-2.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:66f011380d0e49ed280c789fbd08ff0d40968ee7b665575489afa95c98196ab5"},
- {file = "cffi-2.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:c6638687455baf640e37344fe26d37c404db8b80d037c3d29f58fe8d1c3b194d"},
- {file = "cffi-2.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d02d6655b0e54f54c4ef0b94eb6be0607b70853c45ce98bd278dc7de718be5d"},
- {file = "cffi-2.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8eca2a813c1cb7ad4fb74d368c2ffbbb4789d377ee5bb8df98373c2cc0dee76c"},
- {file = "cffi-2.0.0-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:21d1152871b019407d8ac3985f6775c079416c282e431a4da6afe7aefd2bccbe"},
- {file = "cffi-2.0.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b21e08af67b8a103c71a250401c78d5e0893beff75e28c53c98f4de42f774062"},
- {file = "cffi-2.0.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:1e3a615586f05fc4065a8b22b8152f0c1b00cdbc60596d187c2a74f9e3036e4e"},
- {file = "cffi-2.0.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:81afed14892743bbe14dacb9e36d9e0e504cd204e0b165062c488942b9718037"},
- {file = "cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3e17ed538242334bf70832644a32a7aae3d83b57567f9fd60a26257e992b79ba"},
- {file = "cffi-2.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3925dd22fa2b7699ed2617149842d2e6adde22b262fcbfada50e3d195e4b3a94"},
- {file = "cffi-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2c8f814d84194c9ea681642fd164267891702542f028a15fc97d4674b6206187"},
- {file = "cffi-2.0.0-cp312-cp312-win32.whl", hash = "sha256:da902562c3e9c550df360bfa53c035b2f241fed6d9aef119048073680ace4a18"},
- {file = "cffi-2.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:da68248800ad6320861f129cd9c1bf96ca849a2771a59e0344e88681905916f5"},
- {file = "cffi-2.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:4671d9dd5ec934cb9a73e7ee9676f9362aba54f7f34910956b84d727b0d73fb6"},
- {file = "cffi-2.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb"},
- {file = "cffi-2.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:45d5e886156860dc35862657e1494b9bae8dfa63bf56796f2fb56e1679fc0bca"},
- {file = "cffi-2.0.0-cp313-cp313-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:07b271772c100085dd28b74fa0cd81c8fb1a3ba18b21e03d7c27f3436a10606b"},
- {file = "cffi-2.0.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d48a880098c96020b02d5a1f7d9251308510ce8858940e6fa99ece33f610838b"},
- {file = "cffi-2.0.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:f93fd8e5c8c0a4aa1f424d6173f14a892044054871c771f8566e4008eaa359d2"},
- {file = "cffi-2.0.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:dd4f05f54a52fb558f1ba9f528228066954fee3ebe629fc1660d874d040ae5a3"},
- {file = "cffi-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c8d3b5532fc71b7a77c09192b4a5a200ea992702734a2e9279a37f2478236f26"},
- {file = "cffi-2.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d9b29c1f0ae438d5ee9acb31cadee00a58c46cc9c0b2f9038c6b0b3470877a8c"},
- {file = "cffi-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6d50360be4546678fc1b79ffe7a66265e28667840010348dd69a314145807a1b"},
- {file = "cffi-2.0.0-cp313-cp313-win32.whl", hash = "sha256:74a03b9698e198d47562765773b4a8309919089150a0bb17d829ad7b44b60d27"},
- {file = "cffi-2.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:19f705ada2530c1167abacb171925dd886168931e0a7b78f5bffcae5c6b5be75"},
- {file = "cffi-2.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:256f80b80ca3853f90c21b23ee78cd008713787b1b1e93eae9f3d6a7134abd91"},
- {file = "cffi-2.0.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5"},
- {file = "cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13"},
- {file = "cffi-2.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b"},
- {file = "cffi-2.0.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c"},
- {file = "cffi-2.0.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef"},
- {file = "cffi-2.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775"},
- {file = "cffi-2.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205"},
- {file = "cffi-2.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1"},
- {file = "cffi-2.0.0-cp314-cp314-win32.whl", hash = "sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f"},
- {file = "cffi-2.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25"},
- {file = "cffi-2.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad"},
- {file = "cffi-2.0.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9"},
- {file = "cffi-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d"},
- {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c"},
- {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8"},
- {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc"},
- {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592"},
- {file = "cffi-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512"},
- {file = "cffi-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4"},
- {file = "cffi-2.0.0-cp314-cp314t-win32.whl", hash = "sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e"},
- {file = "cffi-2.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6"},
- {file = "cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9"},
- {file = "cffi-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:fe562eb1a64e67dd297ccc4f5addea2501664954f2692b69a76449ec7913ecbf"},
- {file = "cffi-2.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:de8dad4425a6ca6e4e5e297b27b5c824ecc7581910bf9aee86cb6835e6812aa7"},
- {file = "cffi-2.0.0-cp39-cp39-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:4647afc2f90d1ddd33441e5b0e85b16b12ddec4fca55f0d9671fef036ecca27c"},
- {file = "cffi-2.0.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3f4d46d8b35698056ec29bca21546e1551a205058ae1a181d871e278b0b28165"},
- {file = "cffi-2.0.0-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:e6e73b9e02893c764e7e8d5bb5ce277f1a009cd5243f8228f75f842bf937c534"},
- {file = "cffi-2.0.0-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:cb527a79772e5ef98fb1d700678fe031e353e765d1ca2d409c92263c6d43e09f"},
- {file = "cffi-2.0.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:61d028e90346df14fedc3d1e5441df818d095f3b87d286825dfcbd6459b7ef63"},
- {file = "cffi-2.0.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:0f6084a0ea23d05d20c3edcda20c3d006f9b6f3fefeac38f59262e10cef47ee2"},
- {file = "cffi-2.0.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:1cd13c99ce269b3ed80b417dcd591415d3372bcac067009b6e0f59c7d4015e65"},
- {file = "cffi-2.0.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:89472c9762729b5ae1ad974b777416bfda4ac5642423fa93bd57a09204712322"},
- {file = "cffi-2.0.0-cp39-cp39-win32.whl", hash = "sha256:2081580ebb843f759b9f617314a24ed5738c51d2aee65d31e02f6f7a2b97707a"},
- {file = "cffi-2.0.0-cp39-cp39-win_amd64.whl", hash = "sha256:b882b3df248017dba09d6b16defe9b5c407fe32fc7c65a9c69798e6175601be9"},
- {file = "cffi-2.0.0.tar.gz", hash = "sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529"},
-]
-markers = {main = "(platform_python_implementation != \"PyPy\" or extra == \"proxy\") and python_version >= \"3.10\"", dev = "python_version >= \"3.10\" and platform_python_implementation != \"PyPy\"", proxy-dev = "python_version >= \"3.10\" and platform_python_implementation != \"PyPy\""}
-
-[package.dependencies]
-pycparser = {version = "*", markers = "implementation_name != \"PyPy\""}
-
[[package]]
name = "charset-normalizer"
version = "3.4.4"
@@ -2091,89 +1992,10 @@ files = [
{file = "grpcio-1.70.0-cp39-cp39-win_amd64.whl", hash = "sha256:a31d7e3b529c94e930a117b2175b2efd179d96eb3c7a21ccb0289a8ab05b645c"},
{file = "grpcio-1.70.0.tar.gz", hash = "sha256:8d1584a68d5922330025881e63a6c1b54cc8117291d382e4fa69339b6d914c56"},
]
-markers = {main = "python_version < \"3.10\" and extra == \"extra-proxy\"", dev = "python_version < \"3.10\"", proxy-dev = "python_version < \"3.10\""}
[package.extras]
protobuf = ["grpcio-tools (>=1.70.0)"]
-[[package]]
-name = "grpcio"
-version = "1.76.0"
-description = "HTTP/2-based RPC framework"
-optional = false
-python-versions = ">=3.9"
-groups = ["main", "dev", "proxy-dev"]
-files = [
- {file = "grpcio-1.76.0-cp310-cp310-linux_armv7l.whl", hash = "sha256:65a20de41e85648e00305c1bb09a3598f840422e522277641145a32d42dcefcc"},
- {file = "grpcio-1.76.0-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:40ad3afe81676fd9ec6d9d406eda00933f218038433980aa19d401490e46ecde"},
- {file = "grpcio-1.76.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:035d90bc79eaa4bed83f524331d55e35820725c9fbb00ffa1904d5550ed7ede3"},
- {file = "grpcio-1.76.0-cp310-cp310-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:4215d3a102bd95e2e11b5395c78562967959824156af11fa93d18fdd18050990"},
- {file = "grpcio-1.76.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:49ce47231818806067aea3324d4bf13825b658ad662d3b25fada0bdad9b8a6af"},
- {file = "grpcio-1.76.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:8cc3309d8e08fd79089e13ed4819d0af72aa935dd8f435a195fd152796752ff2"},
- {file = "grpcio-1.76.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:971fd5a1d6e62e00d945423a567e42eb1fa678ba89072832185ca836a94daaa6"},
- {file = "grpcio-1.76.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:9d9adda641db7207e800a7f089068f6f645959f2df27e870ee81d44701dd9db3"},
- {file = "grpcio-1.76.0-cp310-cp310-win32.whl", hash = "sha256:063065249d9e7e0782d03d2bca50787f53bd0fb89a67de9a7b521c4a01f1989b"},
- {file = "grpcio-1.76.0-cp310-cp310-win_amd64.whl", hash = "sha256:a6ae758eb08088d36812dd5d9af7a9859c05b1e0f714470ea243694b49278e7b"},
- {file = "grpcio-1.76.0-cp311-cp311-linux_armv7l.whl", hash = "sha256:2e1743fbd7f5fa713a1b0a8ac8ebabf0ec980b5d8809ec358d488e273b9cf02a"},
- {file = "grpcio-1.76.0-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:a8c2cf1209497cf659a667d7dea88985e834c24b7c3b605e6254cbb5076d985c"},
- {file = "grpcio-1.76.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:08caea849a9d3c71a542827d6df9d5a69067b0a1efbea8a855633ff5d9571465"},
- {file = "grpcio-1.76.0-cp311-cp311-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:f0e34c2079d47ae9f6188211db9e777c619a21d4faba6977774e8fa43b085e48"},
- {file = "grpcio-1.76.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8843114c0cfce61b40ad48df65abcfc00d4dba82eae8718fab5352390848c5da"},
- {file = "grpcio-1.76.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8eddfb4d203a237da6f3cc8a540dad0517d274b5a1e9e636fd8d2c79b5c1d397"},
- {file = "grpcio-1.76.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:32483fe2aab2c3794101c2a159070584e5db11d0aa091b2c0ea9c4fc43d0d749"},
- {file = "grpcio-1.76.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:dcfe41187da8992c5f40aa8c5ec086fa3672834d2be57a32384c08d5a05b4c00"},
- {file = "grpcio-1.76.0-cp311-cp311-win32.whl", hash = "sha256:2107b0c024d1b35f4083f11245c0e23846ae64d02f40b2b226684840260ed054"},
- {file = "grpcio-1.76.0-cp311-cp311-win_amd64.whl", hash = "sha256:522175aba7af9113c48ec10cc471b9b9bd4f6ceb36aeb4544a8e2c80ed9d252d"},
- {file = "grpcio-1.76.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:81fd9652b37b36f16138611c7e884eb82e0cec137c40d3ef7c3f9b3ed00f6ed8"},
- {file = "grpcio-1.76.0-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:04bbe1bfe3a68bbfd4e52402ab7d4eb59d72d02647ae2042204326cf4bbad280"},
- {file = "grpcio-1.76.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d388087771c837cdb6515539f43b9d4bf0b0f23593a24054ac16f7a960be16f4"},
- {file = "grpcio-1.76.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:9f8f757bebaaea112c00dba718fc0d3260052ce714e25804a03f93f5d1c6cc11"},
- {file = "grpcio-1.76.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:980a846182ce88c4f2f7e2c22c56aefd515daeb36149d1c897f83cf57999e0b6"},
- {file = "grpcio-1.76.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:f92f88e6c033db65a5ae3d97905c8fea9c725b63e28d5a75cb73b49bda5024d8"},
- {file = "grpcio-1.76.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:4baf3cbe2f0be3289eb68ac8ae771156971848bb8aaff60bad42005539431980"},
- {file = "grpcio-1.76.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:615ba64c208aaceb5ec83bfdce7728b80bfeb8be97562944836a7a0a9647d882"},
- {file = "grpcio-1.76.0-cp312-cp312-win32.whl", hash = "sha256:45d59a649a82df5718fd9527ce775fd66d1af35e6d31abdcdc906a49c6822958"},
- {file = "grpcio-1.76.0-cp312-cp312-win_amd64.whl", hash = "sha256:c088e7a90b6017307f423efbb9d1ba97a22aa2170876223f9709e9d1de0b5347"},
- {file = "grpcio-1.76.0-cp313-cp313-linux_armv7l.whl", hash = "sha256:26ef06c73eb53267c2b319f43e6634c7556ea37672029241a056629af27c10e2"},
- {file = "grpcio-1.76.0-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:45e0111e73f43f735d70786557dc38141185072d7ff8dc1829d6a77ac1471468"},
- {file = "grpcio-1.76.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:83d57312a58dcfe2a3a0f9d1389b299438909a02db60e2f2ea2ae2d8034909d3"},
- {file = "grpcio-1.76.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:3e2a27c89eb9ac3d81ec8835e12414d73536c6e620355d65102503064a4ed6eb"},
- {file = "grpcio-1.76.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:61f69297cba3950a524f61c7c8ee12e55c486cb5f7db47ff9dcee33da6f0d3ae"},
- {file = "grpcio-1.76.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6a15c17af8839b6801d554263c546c69c4d7718ad4321e3166175b37eaacca77"},
- {file = "grpcio-1.76.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:25a18e9810fbc7e7f03ec2516addc116a957f8cbb8cbc95ccc80faa072743d03"},
- {file = "grpcio-1.76.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:931091142fd8cc14edccc0845a79248bc155425eee9a98b2db2ea4f00a235a42"},
- {file = "grpcio-1.76.0-cp313-cp313-win32.whl", hash = "sha256:5e8571632780e08526f118f74170ad8d50fb0a48c23a746bef2a6ebade3abd6f"},
- {file = "grpcio-1.76.0-cp313-cp313-win_amd64.whl", hash = "sha256:f9f7bd5faab55f47231ad8dba7787866b69f5e93bc306e3915606779bbfb4ba8"},
- {file = "grpcio-1.76.0-cp314-cp314-linux_armv7l.whl", hash = "sha256:ff8a59ea85a1f2191a0ffcc61298c571bc566332f82e5f5be1b83c9d8e668a62"},
- {file = "grpcio-1.76.0-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:06c3d6b076e7b593905d04fdba6a0525711b3466f43b3400266f04ff735de0cd"},
- {file = "grpcio-1.76.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fd5ef5932f6475c436c4a55e4336ebbe47bd3272be04964a03d316bbf4afbcbc"},
- {file = "grpcio-1.76.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:b331680e46239e090f5b3cead313cc772f6caa7d0fc8de349337563125361a4a"},
- {file = "grpcio-1.76.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2229ae655ec4e8999599469559e97630185fdd53ae1e8997d147b7c9b2b72cba"},
- {file = "grpcio-1.76.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:490fa6d203992c47c7b9e4a9d39003a0c2bcc1c9aa3c058730884bbbb0ee9f09"},
- {file = "grpcio-1.76.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:479496325ce554792dba6548fae3df31a72cef7bad71ca2e12b0e58f9b336bfc"},
- {file = "grpcio-1.76.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:1c9b93f79f48b03ada57ea24725d83a30284a012ec27eab2cf7e50a550cbbbcc"},
- {file = "grpcio-1.76.0-cp314-cp314-win32.whl", hash = "sha256:747fa73efa9b8b1488a95d0ba1039c8e2dca0f741612d80415b1e1c560febf4e"},
- {file = "grpcio-1.76.0-cp314-cp314-win_amd64.whl", hash = "sha256:922fa70ba549fce362d2e2871ab542082d66e2aaf0c19480ea453905b01f384e"},
- {file = "grpcio-1.76.0-cp39-cp39-linux_armv7l.whl", hash = "sha256:8ebe63ee5f8fa4296b1b8cfc743f870d10e902ca18afc65c68cf46fd39bb0783"},
- {file = "grpcio-1.76.0-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:3bf0f392c0b806905ed174dcd8bdd5e418a40d5567a05615a030a5aeddea692d"},
- {file = "grpcio-1.76.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0b7604868b38c1bfd5cf72d768aedd7db41d78cb6a4a18585e33fb0f9f2363fd"},
- {file = "grpcio-1.76.0-cp39-cp39-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:e6d1db20594d9daba22f90da738b1a0441a7427552cc6e2e3d1297aeddc00378"},
- {file = "grpcio-1.76.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d099566accf23d21037f18a2a63d323075bebace807742e4b0ac210971d4dd70"},
- {file = "grpcio-1.76.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:ebea5cc3aa8ea72e04df9913492f9a96d9348db876f9dda3ad729cfedf7ac416"},
- {file = "grpcio-1.76.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:0c37db8606c258e2ee0c56b78c62fc9dee0e901b5dbdcf816c2dd4ad652b8b0c"},
- {file = "grpcio-1.76.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:ebebf83299b0cb1721a8859ea98f3a77811e35dce7609c5c963b9ad90728f886"},
- {file = "grpcio-1.76.0-cp39-cp39-win32.whl", hash = "sha256:0aaa82d0813fd4c8e589fac9b65d7dd88702555f702fb10417f96e2a2a6d4c0f"},
- {file = "grpcio-1.76.0-cp39-cp39-win_amd64.whl", hash = "sha256:acab0277c40eff7143c2323190ea57b9ee5fd353d8190ee9652369fae735668a"},
- {file = "grpcio-1.76.0.tar.gz", hash = "sha256:7be78388d6da1a25c0d5ec506523db58b18be22d9c37d8d3a32c08be4987bd73"},
-]
-markers = {main = "python_version >= \"3.10\" and extra == \"extra-proxy\"", dev = "python_version >= \"3.10\"", proxy-dev = "python_version >= \"3.10\""}
-
-[package.dependencies]
-typing-extensions = ">=4.12,<5.0"
-
-[package.extras]
-protobuf = ["grpcio-tools (>=1.76.0)"]
-
[[package]]
name = "grpcio-status"
version = "1.62.3"
@@ -2839,13 +2661,13 @@ openai = ["openai (>=0.27.8)"]
[[package]]
name = "litellm-enterprise"
-version = "0.1.20"
+version = "0.1.21"
description = "Package for LiteLLM Enterprise features"
optional = true
python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8"
files = [
- {file = "litellm_enterprise-0.1.20-py3-none-any.whl", hash = "sha256:744a79956a8cd7748ef4c3f40d5a564c61519834e706beafbc0b931162773ae8"},
- {file = "litellm_enterprise-0.1.20.tar.gz", hash = "sha256:f6b8dd75b53bd835c68caf6402a8bae744a150db7bb6b0e617178c6056ac6c01"},
+ {file = "litellm_enterprise-0.1.21-py3-none-any.whl", hash = "sha256:382cf030650a6318155f4b03e0149245706e429345906cde04cb31905eae8398"},
+ {file = "litellm_enterprise-0.1.21.tar.gz", hash = "sha256:2e9d9603ecbbced887d5028afd73663c4db7159a0a213f2e69844e8f9e7692b5"},
]
[[package]]
@@ -4422,7 +4244,6 @@ files = [
{file = "pycparser-2.23-py3-none-any.whl", hash = "sha256:e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934"},
{file = "pycparser-2.23.tar.gz", hash = "sha256:78816d4f24add8f10a06d6f05b4d424ad9e96cfebf68a4ddc99c65c0720d00c2"},
]
-markers = {main = "(platform_python_implementation != \"PyPy\" or extra == \"proxy\") and (implementation_name != \"PyPy\" or python_version < \"3.10\")", dev = "platform_python_implementation != \"PyPy\" and (implementation_name != \"PyPy\" or python_version < \"3.10\")", proxy-dev = "platform_python_implementation != \"PyPy\" and (implementation_name != \"PyPy\" or python_version < \"3.10\")"}
[[package]]
name = "pydantic"
@@ -6794,4 +6615,4 @@ utils = ["numpydoc"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.8.1,<4.0, !=3.9.7"
-content-hash = "379f28b7fb636334a23c75722bd6cda173c8e717384e7491e75057a9862fce38"
+content-hash = "ced4152a4f49f03f1909103e4ee1738d4f7c0f04bc9c7ea5f59a84917a4b19d7"
diff --git a/pyproject.toml b/pyproject.toml
index c841c49628d..cd38c0da5d2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -61,7 +61,7 @@ redisvl = {version = "^0.4.1", optional = true, markers = "python_version >= '3.
mcp = {version = "^1.10.0", optional = true, python = ">=3.10"}
litellm-proxy-extras = {version = "0.4.5", optional = true}
rich = {version = "13.7.1", optional = true}
-litellm-enterprise = {version = "0.1.20", optional = true}
+litellm-enterprise = {version = "0.1.21", optional = true}
diskcache = {version = "^5.6.1", optional = true}
polars = {version = "^1.31.0", optional = true, python = ">=3.10"}
semantic-router = {version = "*", optional = true, python = ">=3.9"}
@@ -159,7 +159,7 @@ requires = ["poetry-core", "wheel"]
build-backend = "poetry.core.masonry.api"
[tool.commitizen]
-version = "1.80.0"
+version = "1.80.2"
version_files = [
"pyproject.toml:^version"
]
diff --git a/requirements.txt b/requirements.txt
index 41bfd9c58d3..ef8c8b2ee0e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -63,4 +63,4 @@ soundfile==0.12.1 # for audio file processing
########################
# LITELLM ENTERPRISE DEPENDENCIES
########################
-litellm-enterprise==0.1.20
+litellm-enterprise==0.1.21
diff --git a/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py b/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
index c364c311b14..c56582adf46 100644
--- a/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
+++ b/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
@@ -25,7 +25,7 @@ from litellm.types.utils import (
)
try:
- from litellm_enterprise.integrations.prometheus import (
+ from litellm.integrations.prometheus import (
PrometheusLogger,
UserAPIKeyLabelValues,
get_custom_labels_from_metadata,
@@ -1069,8 +1069,7 @@ def test_increment_deployment_cooled_down(prometheus_logger):
@pytest.mark.parametrize("enable_end_user_cost_tracking_prometheus_only", [True, False])
def test_prometheus_factory(monkeypatch, enable_end_user_cost_tracking_prometheus_only):
- from litellm_enterprise.integrations.prometheus import prometheus_label_factory
-
+ from litellm.integrations.prometheus import prometheus_label_factory
from litellm.types.integrations.prometheus import UserAPIKeyLabelValues
monkeypatch.setattr(
@@ -1112,7 +1111,7 @@ def test_get_custom_labels_from_metadata_tags(monkeypatch):
def test_get_custom_labels_from_tags(monkeypatch):
- from litellm_enterprise.integrations.prometheus import get_custom_labels_from_tags
+ from litellm.integrations.prometheus import get_custom_labels_from_tags
monkeypatch.setattr(
"litellm.custom_prometheus_tags", ["prod", "test-env", "batch.job"]
@@ -1127,7 +1126,7 @@ def test_get_custom_labels_from_tags(monkeypatch):
def test_get_custom_labels_from_tags_empty_config(monkeypatch):
- from litellm_enterprise.integrations.prometheus import get_custom_labels_from_tags
+ from litellm.integrations.prometheus import get_custom_labels_from_tags
monkeypatch.setattr("litellm.custom_prometheus_tags", [])
tags = ["prod", "debug"]
@@ -1136,7 +1135,7 @@ def test_get_custom_labels_from_tags_empty_config(monkeypatch):
def test_get_custom_labels_from_tags_no_tags(monkeypatch):
- from litellm_enterprise.integrations.prometheus import get_custom_labels_from_tags
+ from litellm.integrations.prometheus import get_custom_labels_from_tags
monkeypatch.setattr("litellm.custom_prometheus_tags", ["prod", "test"])
tags = []
@@ -1149,7 +1148,7 @@ def test_get_custom_labels_from_tags_no_tags(monkeypatch):
def test_get_custom_labels_from_tags_wildcard_patterns(monkeypatch):
"""Test wildcard pattern matching for custom labels from tags."""
- from litellm_enterprise.integrations.prometheus import get_custom_labels_from_tags
+ from litellm.integrations.prometheus import get_custom_labels_from_tags
# Configure tags with wildcard patterns
monkeypatch.setattr(
@@ -1188,7 +1187,7 @@ def test_get_custom_labels_from_tags_wildcard_patterns(monkeypatch):
def test_get_custom_labels_from_tags_wildcard_no_matches(monkeypatch):
"""Test wildcard patterns that don't match any tags."""
- from litellm_enterprise.integrations.prometheus import get_custom_labels_from_tags
+ from litellm.integrations.prometheus import get_custom_labels_from_tags
# Configure tags with wildcard patterns
monkeypatch.setattr(
@@ -1217,9 +1216,7 @@ def test_get_custom_labels_from_tags_wildcard_no_matches(monkeypatch):
def test_tag_matches_wildcard_configured_pattern():
"""Test the helper function for wildcard pattern matching."""
- from litellm_enterprise.integrations.prometheus import (
- _tag_matches_wildcard_configured_pattern,
- )
+ from litellm.integrations.prometheus import _tag_matches_wildcard_configured_pattern
# Test cases that should match
assert (
@@ -1689,11 +1686,10 @@ def test_prometheus_label_factory_with_custom_tags(monkeypatch):
"""
Test that prometheus_label_factory correctly handles custom tags
"""
- from litellm_enterprise.integrations.prometheus import (
+ from litellm.integrations.prometheus import (
get_custom_labels_from_tags,
prometheus_label_factory,
)
-
from litellm.types.integrations.prometheus import UserAPIKeyLabelValues
# Set custom tags configuration
@@ -1728,11 +1724,10 @@ def test_prometheus_label_factory_with_no_custom_tags(monkeypatch):
"""
Test that prometheus_label_factory works when no custom tags are configured
"""
- from litellm_enterprise.integrations.prometheus import (
+ from litellm.integrations.prometheus import (
get_custom_labels_from_tags,
prometheus_label_factory,
)
-
from litellm.types.integrations.prometheus import UserAPIKeyLabelValues
# Set empty custom tags configuration
diff --git a/tests/enterprise/litellm_enterprise/integrations/test_prometheus.py b/tests/enterprise/litellm_enterprise/integrations/test_prometheus.py
index 7e01bda1f26..53757390a44 100644
--- a/tests/enterprise/litellm_enterprise/integrations/test_prometheus.py
+++ b/tests/enterprise/litellm_enterprise/integrations/test_prometheus.py
@@ -23,8 +23,12 @@ from prometheus_client import REGISTRY
import litellm
from litellm.constants import PROMETHEUS_BUDGET_METRICS_REFRESH_INTERVAL_MINUTES
+
try:
- from enterprise.litellm_enterprise.integrations.prometheus import PrometheusLogger, prometheus_label_factory
+ from litellm.integrations.prometheus import (
+ PrometheusLogger,
+ prometheus_label_factory,
+ )
except Exception:
PrometheusLogger = None
prometheus_label_factory = None
@@ -375,6 +379,7 @@ def test_basic_functionality():
# VALIDATION TESTS - Test the new validation logic for metrics and labels
# ==============================================================================
+
def test_invalid_metric_name_validation():
"""Test that invalid metric names are caught and raise ValueError"""
# Clear registry before test
@@ -383,7 +388,7 @@ def test_invalid_metric_name_validation():
# Set up test configuration with invalid metric name
test_config = [
{
- "group": "service_metrics",
+ "group": "service_metrics",
"metrics": [
"invalid_metric_name_that_does_not_exist",
"litellm_deployment_total_requests", # valid metric
@@ -397,7 +402,7 @@ def test_invalid_metric_name_validation():
# Creating PrometheusLogger should raise ValueError due to invalid metric
with pytest.raises(ValueError) as exc_info:
PrometheusLogger()
-
+
# Verify error message contains information about invalid metric
assert "invalid_metric_name_that_does_not_exist" in str(exc_info.value)
assert "Configuration validation failed" in str(exc_info.value)
@@ -426,7 +431,7 @@ def test_invalid_labels_validation():
# Creating PrometheusLogger should raise ValueError due to invalid labels
with pytest.raises(ValueError) as exc_info:
PrometheusLogger()
-
+
# Verify error message contains information about invalid labels
assert "invalid_label_name" in str(exc_info.value)
assert "Configuration validation failed" in str(exc_info.value)
@@ -447,7 +452,7 @@ def test_valid_configuration_passes_validation():
],
"include_labels": [
"litellm_model_name",
- "api_provider",
+ "api_provider",
"requested_model",
],
}
@@ -460,9 +465,9 @@ def test_valid_configuration_passes_validation():
logger = PrometheusLogger()
# Verify the logger was created successfully
assert logger is not None
- assert hasattr(logger, 'enabled_metrics')
- assert 'litellm_deployment_total_requests' in logger.enabled_metrics
- assert 'litellm_deployment_failure_responses' in logger.enabled_metrics
+ assert hasattr(logger, "enabled_metrics")
+ assert "litellm_deployment_total_requests" in logger.enabled_metrics
+ assert "litellm_deployment_failure_responses" in logger.enabled_metrics
except Exception as e:
pytest.fail(f"Valid configuration should not raise exception: {e}")
@@ -844,56 +849,67 @@ async def test_spend_counter_semantics(mock_prometheus_logger):
# CALLBACK FAILURE METRICS TESTS
# ==============================================================================
+
def test_callback_failure_metric_increments(prometheus_logger):
"""
Test that the callback logging failure metric can be incremented.
-
+
This tests the litellm_callback_logging_failures_metric counter.
"""
# Get initial value
initial_value = 0
try:
- initial_value = prometheus_logger.litellm_callback_logging_failures_metric.labels(
- callback_name="S3Logger"
- )._value.get()
+ initial_value = (
+ prometheus_logger.litellm_callback_logging_failures_metric.labels(
+ callback_name="S3Logger"
+ )._value.get()
+ )
except Exception:
initial_value = 0
-
+
# Increment the metric
prometheus_logger.increment_callback_logging_failure(callback_name="S3Logger")
-
+
# Verify it incremented by 1
current_value = prometheus_logger.litellm_callback_logging_failures_metric.labels(
callback_name="S3Logger"
)._value.get()
-
- assert current_value == initial_value + 1, \
- f"Expected callback failure metric to increment by 1, got {current_value - initial_value}"
-
+
+ assert (
+ current_value == initial_value + 1
+ ), f"Expected callback failure metric to increment by 1, got {current_value - initial_value}"
+
# Increment again for different callback
prometheus_logger.increment_callback_logging_failure(callback_name="LangFuseLogger")
-
+
langfuse_value = prometheus_logger.litellm_callback_logging_failures_metric.labels(
callback_name="LangFuseLogger"
)._value.get()
-
+
assert langfuse_value == 1, "LangFuseLogger metric should be 1"
-
+
# S3Logger should still be initial + 1
s3_value = prometheus_logger.litellm_callback_logging_failures_metric.labels(
callback_name="S3Logger"
)._value.get()
assert s3_value == initial_value + 1, "S3Logger metric should not change"
-
- print(f"✓ Callback failure metric test passed: S3Logger={s3_value}, LangFuseLogger={langfuse_value}")
+
+ print(
+ f"✓ Callback failure metric test passed: S3Logger={s3_value}, LangFuseLogger={langfuse_value}"
+ )
def test_callback_failure_metric_different_callbacks(prometheus_logger):
"""
Test that different callbacks are tracked separately with their own labels.
"""
- callbacks_to_test = ["S3Logger", "LangFuseLogger", "DataDogLogger", "CustomCallback"]
-
+ callbacks_to_test = [
+ "S3Logger",
+ "LangFuseLogger",
+ "DataDogLogger",
+ "CustomCallback",
+ ]
+
for callback_name in callbacks_to_test:
# Get initial value
initial = 0
@@ -903,19 +919,22 @@ def test_callback_failure_metric_different_callbacks(prometheus_logger):
)._value.get()
except Exception:
initial = 0
-
+
# Increment
- prometheus_logger.increment_callback_logging_failure(callback_name=callback_name)
-
+ prometheus_logger.increment_callback_logging_failure(
+ callback_name=callback_name
+ )
+
# Verify incremented
current = prometheus_logger.litellm_callback_logging_failures_metric.labels(
callback_name=callback_name
)._value.get()
-
- assert current == initial + 1, \
- f"{callback_name} should increment by 1"
-
- print(f"✓ Multiple callback tracking test passed for {len(callbacks_to_test)} callbacks")
+
+ assert current == initial + 1, f"{callback_name} should increment by 1"
+
+ print(
+ f"✓ Multiple callback tracking test passed for {len(callbacks_to_test)} callbacks"
+ )
# ==============================================================================
diff --git a/tests/enterprise/litellm_enterprise/integrations/test_prometheus_unit_tests.py b/tests/enterprise/litellm_enterprise/integrations/test_prometheus_unit_tests.py
index 9d142beae11..ab37a0a84cd 100644
--- a/tests/enterprise/litellm_enterprise/integrations/test_prometheus_unit_tests.py
+++ b/tests/enterprise/litellm_enterprise/integrations/test_prometheus_unit_tests.py
@@ -4,7 +4,7 @@ import pytest_asyncio
from prometheus_client import REGISTRY
try:
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
+ from litellm.integrations.prometheus import PrometheusLogger
except Exception:
PrometheusLogger = None
@@ -62,9 +62,11 @@ def prometheus_logger():
with patch("litellm.proxy.proxy_server.premium_user", True):
logger = PrometheusLogger()
+
# Add the missing async_logging_hook method
async def async_logging_hook(kwargs, result, call_type):
return kwargs, result
+
logger.async_logging_hook = async_logging_hook
return logger
@@ -137,7 +139,7 @@ async def test_prometheus_metric_tracking():
try:
from unittest.mock import MagicMock
- from litellm_enterprise.integrations.prometheus import PrometheusLogger
+ from litellm.integrations.prometheus import PrometheusLogger
except Exception:
PrometheusLogger = None
if PrometheusLogger is None:
@@ -203,7 +205,6 @@ async def test_prometheus_metric_tracking():
mock_prometheus.track_provider_remaining_budget.assert_called()
-
class CustomPrometheusLogger(PrometheusLogger):
def __init__(self):
super().__init__()
@@ -238,6 +239,7 @@ class CustomPrometheusLogger(PrometheusLogger):
async def test_router_cooldown_event_callback():
# Clear Prometheus registry to avoid duplicate metric registration
from prometheus_client import REGISTRY
+
collectors = list(REGISTRY._collector_to_names.keys())
for collector in collectors:
REGISTRY.unregister(collector)
@@ -325,4 +327,3 @@ async def test_router_cooldown_event_callback_no_prometheus():
# Assert that the router's get_deployment method was called
mock_router.get_deployment.assert_called_once_with(model_id="test-deployment")
-