{"record":{"id":"f62e6deea79b90d7","repo":"BerriAI/litellm","slug":"033-91mazure-content-safety-not-installed-try-ru","errorCode":null,"errorMessage":"\\033[91mAzure Content-Safety not installed, try running 'pip install azure-ai-contentsafety' to fix this error: {e}\\n{traceback.format_exc()}\\033[0m","messagePattern":"\\\\033\\[91mAzure Content-Safety not installed, try running 'pip install azure-ai-contentsafety' to fix this error: (.+?)\\\\n(.+?)\\\\033\\[0m","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/hooks/azure_content_safety.py","lineNumber":33,"sourceCode":"\n\nclass _PROXY_AzureContentSafety(\n    CustomLogger\n):  # https://docs.litellm.ai/docs/observability/custom_callback#callback-class\n    # Class variables or attributes\n\n    def __init__(self, endpoint, api_key, thresholds=None):\n        try:\n            from azure.ai.contentsafety.aio import ContentSafetyClient\n            from azure.ai.contentsafety.models import (\n                AnalyzeTextOptions,\n                AnalyzeTextOutputType,\n                TextCategory,\n            )\n            from azure.core.credentials import AzureKeyCredential\n            from azure.core.exceptions import HttpResponseError\n        except Exception as e:\n            raise Exception(\n                f\"\\033[91mAzure Content-Safety not installed, try running 'pip install azure-ai-contentsafety' to fix this error: {e}\\n{traceback.format_exc()}\\033[0m\"\n            )\n        self.endpoint = endpoint\n        self.api_key = api_key\n        self.text_category = TextCategory\n        self.analyze_text_options = AnalyzeTextOptions\n        self.analyze_text_output_type = AnalyzeTextOutputType\n        self.azure_http_error = HttpResponseError\n\n        self.thresholds = self._configure_thresholds(thresholds)\n\n        self.client = ContentSafetyClient(self.endpoint, AzureKeyCredential(self.api_key))\n\n    def _configure_thresholds(self, thresholds=None):\n        default_thresholds: Final = {\n            self.text_category.HATE: 4,\n            self.text_category.SELF_HARM: 4,\n            self.text_category.SEXUAL: 4,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/hooks/azure_content_safety.py#L15-L51","documentation":"Error \"\\033[91mAzure Content-Safety not installed, try running 'pip install azure-ai-contentsafety' to fix this error: {e}\\n{traceback.format_exc()}\\033[0m\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/hooks/azure_content_safety.py:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the Azure Content Safety SDK: pip install azure-ai-contentsafety.","Restart the proxy after installing the package."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}