mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Merge 5efa1c25da into d23bec84c4
This commit is contained in:
commit
67a2832ac4
12 changed files with 3784 additions and 0 deletions
|
|
@ -11861,6 +11861,18 @@
|
|||
],
|
||||
"description": "Optional parameters for the guardrail"
|
||||
},
|
||||
"org_code": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Organization code for PointGuardAI.",
|
||||
"title": "Org Code"
|
||||
},
|
||||
"output_parse_pii": {
|
||||
"anyOf": [
|
||||
{
|
||||
|
|
@ -11992,6 +12004,18 @@
|
|||
"description": "Configuration for PII entity types and actions",
|
||||
"title": "Pii Entities Config"
|
||||
},
|
||||
"policy_config_name": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "PointGuardAI policy configuration name.",
|
||||
"title": "Policy Config Name"
|
||||
},
|
||||
"policy_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
from typing import TYPE_CHECKING, Final, Protocol
|
||||
|
||||
from litellm.secret_managers.main import get_secret_str
|
||||
from litellm.types.guardrails import (
|
||||
GuardrailEventHooks,
|
||||
Mode,
|
||||
SupportedGuardrailIntegrations,
|
||||
)
|
||||
|
||||
from .pointguardai import PointGuardAIGuardrail
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from litellm.types.guardrails import Guardrail, LitellmParams
|
||||
|
||||
|
||||
class _CallbackRegistrar(Protocol):
|
||||
def add_litellm_callback(self, callback: PointGuardAIGuardrail) -> None: ...
|
||||
|
||||
|
||||
def _resolve_secret_reference(value: str | None) -> str | None:
|
||||
if value is not None and value.startswith("os.environ/"):
|
||||
return get_secret_str(value)
|
||||
return value
|
||||
|
||||
|
||||
def _coerce_event_hook(
|
||||
mode: str | list[str] | Mode, # mutable-ok: mirrors the LiteLLM mode configuration contract
|
||||
) -> GuardrailEventHooks | list[GuardrailEventHooks] | Mode: # mutable-ok: inherited hook API requires a list
|
||||
if isinstance(mode, Mode):
|
||||
return mode
|
||||
if isinstance(mode, list):
|
||||
return [GuardrailEventHooks(item) for item in mode]
|
||||
return GuardrailEventHooks(mode)
|
||||
|
||||
|
||||
def initialize_guardrail(
|
||||
litellm_params: "LitellmParams",
|
||||
guardrail: "Guardrail",
|
||||
callback_manager: _CallbackRegistrar | None = None,
|
||||
) -> PointGuardAIGuardrail:
|
||||
import litellm
|
||||
|
||||
configured_fields_value: Final = getattr(litellm_params, "model_fields_set", None)
|
||||
configured_fields: Final = (
|
||||
configured_fields_value
|
||||
if configured_fields_value is not None
|
||||
else getattr(litellm_params, "__fields_set__", frozenset())
|
||||
)
|
||||
unreachable_fallback: Final = (
|
||||
litellm_params.unreachable_fallback if "unreachable_fallback" in configured_fields else "fail_closed"
|
||||
)
|
||||
|
||||
pointguardai_guardrail: Final = PointGuardAIGuardrail(
|
||||
guardrail_name=guardrail.get("guardrail_name"),
|
||||
api_key=litellm_params.api_key,
|
||||
api_base=litellm_params.api_base,
|
||||
org_code=_resolve_secret_reference(litellm_params.org_code),
|
||||
policy_config_name=_resolve_secret_reference(litellm_params.policy_config_name),
|
||||
unreachable_fallback=unreachable_fallback,
|
||||
default_on=litellm_params.default_on or False,
|
||||
event_hook=_coerce_event_hook(litellm_params.mode),
|
||||
)
|
||||
|
||||
if callback_manager is None:
|
||||
litellm.logging_callback_manager.add_litellm_callback(pointguardai_guardrail)
|
||||
else:
|
||||
callback_manager.add_litellm_callback(pointguardai_guardrail)
|
||||
return pointguardai_guardrail
|
||||
|
||||
|
||||
guardrail_initializer_registry: Final = { # mutable-ok: LiteLLM registry contract requires a dictionary
|
||||
SupportedGuardrailIntegrations.POINTGUARDAI.value: initialize_guardrail,
|
||||
}
|
||||
|
||||
|
||||
guardrail_class_registry: Final = { # mutable-ok: LiteLLM registry contract requires a dictionary
|
||||
SupportedGuardrailIntegrations.POINTGUARDAI.value: PointGuardAIGuardrail,
|
||||
}
|
||||
|
||||
|
||||
__all__: Final = (
|
||||
"PointGuardAIGuardrail",
|
||||
"guardrail_class_registry",
|
||||
"guardrail_initializer_registry",
|
||||
"initialize_guardrail",
|
||||
)
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -41,6 +41,9 @@ from litellm.types.proxy.guardrails.guardrail_hooks.litellm_content_filter impor
|
|||
from litellm.types.proxy.guardrails.guardrail_hooks.ovalix import (
|
||||
OvalixGuardrailConfigModel,
|
||||
)
|
||||
from litellm.types.proxy.guardrails.guardrail_hooks.pointguardai import (
|
||||
PointGuardAIGuardrailConfigModel,
|
||||
)
|
||||
from litellm.types.proxy.guardrails.guardrail_hooks.promptguard import (
|
||||
PromptGuardConfigModel,
|
||||
)
|
||||
|
|
@ -137,6 +140,7 @@ class SupportedGuardrailIntegrations(Enum):
|
|||
COMPRESR = "compresr"
|
||||
STRAIKER = "straiker"
|
||||
ALICE = "alice"
|
||||
POINTGUARDAI = "pointguard_ai"
|
||||
|
||||
|
||||
class Role(Enum):
|
||||
|
|
@ -1056,6 +1060,7 @@ class LitellmParams( # pyright: ignore[reportIncompatibleVariableOverride] # o
|
|||
ZscalerAIGuardConfigModel,
|
||||
AktoConfigModel,
|
||||
JavelinGuardrailConfigModel,
|
||||
PointGuardAIGuardrailConfigModel,
|
||||
BaseLitellmParams,
|
||||
EnkryptAIGuardrailConfigs,
|
||||
IBMGuardrailsBaseConfigModel,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
from typing import Literal
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from .base import GuardrailConfigModel
|
||||
|
||||
|
||||
class PointGuardAIGuardrailConfigModel(GuardrailConfigModel):
|
||||
"""Configuration parameters for the PointGuardAI v2 guardrail"""
|
||||
|
||||
org_code: str | None = Field(
|
||||
default=None,
|
||||
description="Organization code for PointGuardAI.",
|
||||
)
|
||||
api_base: str | None = Field(
|
||||
default=None,
|
||||
description="Base URL for PointGuardAI. Defaults to https://api.appsoc.com.",
|
||||
)
|
||||
api_key: str | None = Field(
|
||||
default=None,
|
||||
description="API key for PointGuardAI.",
|
||||
)
|
||||
policy_config_name: str | None = Field(
|
||||
default=None,
|
||||
description="PointGuardAI policy configuration name.",
|
||||
)
|
||||
unreachable_fallback: Literal["fail_closed", "fail_open"] = Field(
|
||||
default="fail_closed",
|
||||
description=(
|
||||
"Behavior when PointGuardAI is unreachable. 'fail_closed' raises an error "
|
||||
"(default); 'fail_open' logs a critical error and allows the request."
|
||||
),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def ui_friendly_name() -> str:
|
||||
return "PointGuard AI"
|
||||
File diff suppressed because it is too large
Load diff
BIN
ui/litellm-dashboard/public/assets/logos/pointguardai.png
Normal file
BIN
ui/litellm-dashboard/public/assets/logos/pointguardai.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -300,6 +300,12 @@ export const GUARDRAIL_PRESETS: Record<string, GuardrailPreset> = {
|
|||
mode: "pre_call",
|
||||
defaultOn: false,
|
||||
},
|
||||
pointguardai: {
|
||||
provider: "PointguardAi",
|
||||
guardrailNameSuggestion: "PointGuard AI",
|
||||
mode: "pre_call",
|
||||
defaultOn: false,
|
||||
},
|
||||
repelloai: {
|
||||
provider: "Repelloai",
|
||||
guardrailNameSuggestion: "RepelloAI Argus",
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const EXPECTED_PARTNER_LOGO_FILES: Record<string, string> = {
|
|||
promptguard: "promptguard.svg",
|
||||
xecguard: "xecguard.svg",
|
||||
deepkeep: "deepkeep.svg",
|
||||
pointguardai: "pointguardai.png",
|
||||
repelloai: "repelloai.png",
|
||||
straiker: "straiker.svg",
|
||||
alice: "alice.svg",
|
||||
|
|
|
|||
|
|
@ -444,6 +444,16 @@ export const PARTNER_GUARDRAIL_CARDS: GuardrailCardInfo[] = [
|
|||
tags: ["Security", "Prompt Injection", "PII", "Firewall"],
|
||||
providerKey: "Deepkeep",
|
||||
},
|
||||
{
|
||||
id: "pointguardai",
|
||||
name: "PointGuard AI",
|
||||
description:
|
||||
"PointGuard AI runtime guardrails inspect prompts and responses for prompt injection, sensitive data exposure, harmful content, and policy violations.",
|
||||
category: "partner",
|
||||
logo: guardrailLogoMap["PointGuard AI"],
|
||||
tags: ["Security", "Prompt Injection", "Data Protection", "Policy"],
|
||||
providerKey: "PointguardAi",
|
||||
},
|
||||
{
|
||||
id: "repelloai",
|
||||
name: "RepelloAI Argus",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import openaiSmallLogo from "../../../../../public/assets/logos/openai_small.svg
|
|||
import paloAltoNetworksLogo from "../../../../../public/assets/logos/palo_alto_networks.jpeg";
|
||||
import pangeaLogo from "../../../../../public/assets/logos/pangea.png";
|
||||
import pillarLogo from "../../../../../public/assets/logos/pillar.jpeg";
|
||||
import pointguardAiLogo from "../../../../../public/assets/logos/pointguardai.png";
|
||||
import promptSecurityLogo from "../../../../../public/assets/logos/prompt_security.png";
|
||||
import promptguardLogo from "../../../../../public/assets/logos/promptguard.svg";
|
||||
import qohashLogo from "../../../../../public/assets/logos/qohash.jpg";
|
||||
|
|
@ -82,6 +83,7 @@ export const guardrail_provider_map: Record<string, string> = {
|
|||
LlmAsAJudge: "llm_as_a_judge",
|
||||
Xecguard: "xecguard",
|
||||
Deepkeep: "deepkeep",
|
||||
PointguardAi: "pointguard_ai",
|
||||
QostodianNexus: "qostodian_nexus",
|
||||
Repelloai: "repelloai",
|
||||
Alice: "alice",
|
||||
|
|
@ -204,6 +206,7 @@ export const guardrailLogoMap = {
|
|||
"Hide Secrets": litellmLogo.src,
|
||||
Akto: aktoLogo.src,
|
||||
"DeepKeep AI Firewall": deepkeepLogo.src,
|
||||
"PointGuard AI": pointguardAiLogo.src,
|
||||
"Qostodian Nexus": qohashLogo.src,
|
||||
"RepelloAI Argus": repelloAiLogo.src,
|
||||
Straiker: straikerLogo.src,
|
||||
|
|
|
|||
10
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
10
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
|
|
@ -30719,6 +30719,11 @@ export interface components {
|
|||
only_scan_new_messages: boolean | null;
|
||||
/** @description Optional parameters for the guardrail */
|
||||
optional_params?: components["schemas"]["CiscoAIDefenseGuardrailConfigModelOptionalParams"] | null;
|
||||
/**
|
||||
* Org Code
|
||||
* @description Organization code for PointGuardAI.
|
||||
*/
|
||||
org_code?: string | null;
|
||||
/**
|
||||
* Output Parse Pii
|
||||
* @description When True, LiteLLM will replace the masked text with the original text in the response
|
||||
|
|
@ -30773,6 +30778,11 @@ export interface components {
|
|||
pii_entities_config?: {
|
||||
[key: string]: components["schemas"]["PiiAction"];
|
||||
} | null;
|
||||
/**
|
||||
* Policy Config Name
|
||||
* @description PointGuardAI policy configuration name.
|
||||
*/
|
||||
policy_config_name?: string | null;
|
||||
/**
|
||||
* Policy Id
|
||||
* @description Policy ID for Zscaler AI Guard. Can also be set via ZSCALER_AI_GUARD_POLICY_ID environment variable
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue