733ba34f6d
server/guardrails/noop.py implements the Guardrail interface with an always-allow stub so the Pipecat pipeline has the pluggable hook from SLICE-02. Swapping to CustomerServiceGuardrail (SLICE-03 TASK-03-04) requires no pipeline change (D-019). The session-start disclaimer text (RESEARCH.md safety baseline) is defined here so the pipeline can play it as the first AI utterance even before the real ruleset lands. ---ci--- phase: 1 milestone: v0.1 plan: 02 task: 02-07 status: execute persona: backend-engineer requirements: covered: [REQ-ORCH-02] ---/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"] |