This commit is contained in:
Tanishq 2026-10-28 07:05:09 +05:30 • committed by GitHub
commit 799a3032a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -130,6 +130,15 @@ class GenericGuardrailAPIConfigModel(
):
"""Configuration parameters for the Generic Guardrail API guardrail"""
api_base: str | None = Field(
default=None,
description="Base URL of the guardrail service. Defaults to GENERIC_GUARDRAIL_API_BASE when omitted",
)
api_key: str | None = Field(
default=None,
description="API key sent to the guardrail service in the x-api-key header",
)
optional_params: GenericGuardrailAPIOptionalParams | None = Field(
default_factory=GenericGuardrailAPIOptionalParams,
description="Optional parameters for the Generic Guardrail API guardrail",

View file

@ -956,6 +956,18 @@ async def test_provider_specific_params_includes_embedding_toggle():
assert field["default_value"] is False
@pytest.mark.asyncio
@pytest.mark.parametrize("field_name", ("api_base", "api_key"))
async def test_provider_specific_params_exposes_generic_guardrail_connection_fields(field_name: str) -> None:
from litellm.proxy.guardrails.guardrail_endpoints import get_provider_specific_params
provider_params: Final = await get_provider_specific_params()
field: Final = provider_params["generic_guardrail_api"][field_name]
assert field["type"] == "string"
assert field["required"] is False
@pytest.mark.asyncio
async def test_provider_specific_params_offers_forward_messages_as_sent_off_by_default():
from litellm.proxy.guardrails.guardrail_endpoints import get_provider_specific_params