fbd6602814
---ci--- phase: 0 milestone: v0.1 status: complete ---/ci---
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""NoOpGuardrail — always-allow stub implementing the Guardrail interface (TASK-02-07).
|
|
|
|
SLICE-02 ships this stub so the Pipecat pipeline has the pluggable guardrail hook
|
|
in place from the first slice. SLICE-03 TASK-03-04 swaps in CustomerServiceGuardrail
|
|
with no pipeline change (D-019). The disclaimer text is defined here (matches the
|
|
RESEARCH.md safety baseline) so the pipeline can play it as the first AI utterance
|
|
even before the real ruleset lands.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from server.services.base import Guardrail, GuardrailContext, GuardrailVerdict
|
|
|
|
# The session-start disclaimer (RESEARCH.md §Safety). Played as the first AI
|
|
# utterance of every session. Defined here so it exists from SLICE-02.
|
|
DISCLAIMER_TEXT = (
|
|
"This is an AI practice session for training purposes. "
|
|
"It is not a real conversation and no real company is involved."
|
|
)
|
|
|
|
|
|
class NoOpGuardrail(Guardrail):
|
|
"""Always-allow stub (SLICE-02 placeholder for the Guardrail slot)."""
|
|
|
|
name = "noop"
|
|
|
|
async def check(
|
|
self, text: str, context: GuardrailContext | None = None
|
|
) -> GuardrailVerdict:
|
|
return GuardrailVerdict(allowed=True, reason="noop guardrail — all allowed", category="ok")
|
|
|
|
@property
|
|
def session_start_disclaimer(self) -> str:
|
|
return DISCLAIMER_TEXT
|
|
|
|
|
|
__all__ = ["NoOpGuardrail", "DISCLAIMER_TEXT"] |