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]

add noma guardrail provider to ui (#14415)

Vishnu Patibandlafb9e2c93a0f0
diff --git a/litellm/proxy/guardrails/guardrail_hooks/noma/noma.py b/litellm/proxy/guardrails/guardrail_hooks/noma/noma.py
index 22dffe8b069..06d0af681a0 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/noma/noma.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/noma/noma.py
@@ -8,7 +8,7 @@
import asyncio
import copy
import os
-from typing import Any, Dict, Final, Literal, Optional, Union
+from typing import Any, Dict, Final, Literal, Optional, Union, Type, TYPE_CHECKING
from urllib.parse import urljoin
from fastapi import HTTPException
@@ -34,7 +34,10 @@ SENSITIVE_DATA_DETECTOR_KEYS: Final[list[str]] = ["sensitiveData", "dataDetector
MessageRole = Literal["user", "assistant"]
LLMResponse = Union[Any, ModelResponse, EmbeddingResponse, ImageResponse]
+if TYPE_CHECKING:
+ from litellm.types.proxy.guardrails.guardrail_hooks.base import GuardrailConfigModel
+
class NomaBlockedMessage(HTTPException):
"""Exception raised when Noma guardrail blocks a message"""
@@ -730,3 +733,12 @@ class NomaGuardrail(CustomGuardrail):
verbose_proxy_logger.info(msg)
else:
verbose_proxy_logger.debug(msg)
+
+ @staticmethod
+ def get_config_model() -> Optional[Type["GuardrailConfigModel"]]:
+ from litellm.types.proxy.guardrails.guardrail_hooks.noma import (
+ NomaGuardrailConfigModel,
+ )
+
+ return NomaGuardrailConfigModel
+
diff --git a/litellm/types/proxy/guardrails/guardrail_hooks/noma.py b/litellm/types/proxy/guardrails/guardrail_hooks/noma.py
new file mode 100644
index 00000000000..2d6d4a45124
--- /dev/null
+++ b/litellm/types/proxy/guardrails/guardrail_hooks/noma.py
@@ -0,0 +1,23 @@
+from typing import Optional
+
+from pydantic import BaseModel, Field
+
+from .base import GuardrailConfigModel
+
+class NomaGuardrailConfigModel(GuardrailConfigModel):
+ api_key: Optional[str] = Field(
+ default=None,
+ description="The Noma API key. Reads from NOMA_API_KEY env var if None.",
+ )
+ api_base: Optional[str] = Field(
+ default=None,
+ description="The Noma API base URL. Defaults to https://api.noma.security. Also checks if the NOMA_API_KEY env var is set.",
+ )
+ application_id: Optional[str] = Field(
+ default=None,
+ description="The Noma Application ID. Reads from NOMA_APPLICATION_ID env var if None.",
+ )
+
+ @staticmethod
+ def ui_friendly_name() -> str:
+ return "Noma Security"