fix(guardrails): report Airia supported modes to the dashboard

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-09-29 01:33:02 +00:00
parent eb9c5b6010
commit d006b093a6
2 changed files with 11 additions and 0 deletions

View file

@ -41,6 +41,10 @@ SUPPORTED_EVENT_HOOKS: Final = (GuardrailEventHooks.pre_call, GuardrailEventHook
class AiriaGuardrail(CustomGuardrail):
"""Evaluates prompts and responses against your Airia guardrail policy."""
@classmethod
def get_supported_event_hooks(cls) -> list[GuardrailEventHooks]:
return [*SUPPORTED_EVENT_HOOKS]
def __init__(
self,
api_base: str | None = None,

View file

@ -85,6 +85,13 @@ def test_during_call_is_not_a_supported_event_hook() -> None:
assert list(hooks) == [GuardrailEventHooks.pre_call, GuardrailEventHooks.post_call]
def test_supported_event_hooks_are_exposed_for_ui() -> None:
assert AiriaGuardrail.get_supported_event_hooks() == [
GuardrailEventHooks.pre_call,
GuardrailEventHooks.post_call,
]
@pytest.mark.parametrize("missing", ["api_base", "api_key"])
def test_missing_credentials_raise_at_construction(missing: str, monkeypatch: pytest.MonkeyPatch) -> None:
"""Fail at startup rather than on the first request."""