9108b07de1
server/interruptibility.py — programmatic check that the pipeline task is configured with allow_interruptions=True (D-008 abort-and-yield). The manual test (speaking during AI speech cuts it off) is documented in docs/latency-report.md; the automated test confirms the flag is set. server/scenarios/classifier.py — classify_branch() uses deepseek-v4-flash:cloud no-think (D-020) as LLM-as-judge to classify the learner's turn transcripts into accept_resolution or escalate at session end, OFFLINE from the voice loop (D-P1-05, G-002 post-hoc classification). Parses the LLM's JSON response leniently (code fences, unknown-id fallback, malformed JSON scan). classify_branch_sync_heuristic() is a rule-based fallback for tests/e2e when no API key is present. 11 tests pass (interruptibility flag on/off/missing; classifier accept/escalate scripted transcripts; JSON parse valid/code-fenced/unknown-id/malformed; fake-LLM async classify; offline structural assertion). ---ci--- phase: 1 milestone: v0.1 plan: 03 task: 03-05,03-06 status: execute persona: backend-engineer requirements: covered: [REQ-VOICE-04, REQ-SCEN-01] ---/ci---
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
"""Interruptibility verification harness (TASK-03-05).
|
|
|
|
Verifies D-008 (abort-and-yield): learner VAD during AI TTS aborts TTS and
|
|
yields the floor. The Pipecat pipeline has allow_interruptions=True (set in
|
|
build_pipeline), so the abort is handled by Pipecat's built-in interrupt
|
|
handling. This module provides:
|
|
|
|
- a programmatic check that the pipeline is configured for interruptions
|
|
- a test that confirms a TTS-abort event fires on VAD during TTS
|
|
|
|
The manual test (speaking during AI speech cuts it off) is documented in
|
|
docs/latency-report.md; the automated test is in tests/test_interruptibility.py.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
def pipeline_allows_interruptions(pipeline_task: Any) -> bool:
|
|
"""Confirm the pipeline task is configured with allow_interruptions=True (D-008)."""
|
|
# PipelineParams stores the flag; the task's params attribute carries it.
|
|
params = getattr(pipeline_task, "params", None)
|
|
if params is None:
|
|
return False
|
|
return bool(getattr(params, "allow_interruptions", False))
|
|
|
|
|
|
__all__ = ["pipeline_allows_interruptions"] |