feat: add wake phrase hot keyword support#761
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughWake-phrase gating is introduced to the Breeze Buddy voice agent. A new ChangesWake Phrase Gating for Voice Agent
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/ai/voice/agents/breeze_buddy/template/types.py`:
- Around line 417-422: WakePhraseConfig allows blank phrases and non-positive
timeout when enabled, causing invalid runtime configs; add Pydantic validators
on WakePhraseConfig (use `@root_validator` or field validators) so that when
enabled is True: (1) phrases is a non-empty list and each entry is a non-blank
string (strip and reject ""), and (2) timeout is > 0 (reject <= 0); raise clear
ValueError messages indicating which field is invalid so invalid configs fail at
schema validation instead of at runtime.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5cd6970d-1c8f-4668-b661-08db92c3dbe2
📒 Files selected for processing (2)
app/ai/voice/agents/breeze_buddy/agent/pipeline.pyapp/ai/voice/agents/breeze_buddy/template/types.py
| enabled: bool = False | ||
| phrases: List[str] = Field(default_factory=list) | ||
| timeout: float = Field(10.0, description="Seconds to stay awake after phrase.") | ||
| single_activation: bool = Field( | ||
| False, description="Require phrase before every turn (not just once)." | ||
| ) |
There was a problem hiding this comment.
Validate wake-phrase inputs at schema boundary.
WakePhraseConfig currently permits blank phrases and negative timeout. When enabled=True, this can produce hard-to-debug no-op/invalid configs that are only discovered at runtime.
Suggested fix
class WakePhraseConfig(BaseModel):
@@
enabled: bool = False
phrases: List[str] = Field(default_factory=list)
- timeout: float = Field(10.0, description="Seconds to stay awake after phrase.")
+ timeout: float = Field(
+ 10.0, ge=0.0, description="Seconds to stay awake after phrase."
+ )
single_activation: bool = Field(
False, description="Require phrase before every turn (not just once)."
)
+
+ `@model_validator`(mode="after")
+ def _validate_wake_phrase(self) -> "WakePhraseConfig":
+ self.phrases = [p.strip() for p in self.phrases if p and p.strip()]
+ if self.enabled and not self.phrases:
+ raise ValueError(
+ "wake_phrase.phrases must include at least one non-empty phrase when enabled=true"
+ )
+ return self🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/ai/voice/agents/breeze_buddy/template/types.py` around lines 417 - 422,
WakePhraseConfig allows blank phrases and non-positive timeout when enabled,
causing invalid runtime configs; add Pydantic validators on WakePhraseConfig
(use `@root_validator` or field validators) so that when enabled is True: (1)
phrases is a non-empty list and each entry is a non-blank string (strip and
reject ""), and (2) timeout is > 0 (reject <= 0); raise clear ValueError
messages indicating which field is invalid so invalid configs fail at schema
validation instead of at runtime.
There was a problem hiding this comment.
Pull request overview
Adds optional “wake phrase” gating to the Breeze Buddy voice agent so the bot only starts responding after a configured trigger phrase is heard, via Pipecat’s WakePhraseUserTurnStartStrategy.
Changes:
- Introduces
WakePhraseConfigand exposes it asconfigurations.wake_phrasein the template configuration schema. - Prepends
WakePhraseUserTurnStartStrategyto the user turn start strategy chain when wake-phrase gating is enabled and configured.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/ai/voice/agents/breeze_buddy/template/types.py | Adds WakePhraseConfig and a new wake_phrase field on ConfigurationModel to support template-level configuration. |
| app/ai/voice/agents/breeze_buddy/agent/pipeline.py | Wires the wake phrase config into pipeline construction by adding WakePhraseUserTurnStartStrategy ahead of other start strategies. |
|
|
||
| enabled: bool = False | ||
| phrases: List[str] = Field(default_factory=list) | ||
| timeout: float = Field(10.0, description="Seconds to stay awake after phrase.") |
| phrases: List[str] = Field(default_factory=list) | ||
| timeout: float = Field(10.0, description="Seconds to stay awake after phrase.") | ||
| single_activation: bool = Field( | ||
| False, description="Require phrase before every turn (not just once)." |
| # Wake phrase: prepended first so it gates all subsequent strategies. | ||
| wake_cfg = getattr(configurations, "wake_phrase", None) | ||
| if wake_cfg and wake_cfg.enabled and wake_cfg.phrases: | ||
| start_strategies.append( | ||
| WakePhraseUserTurnStartStrategy( | ||
| phrases=wake_cfg.phrases, | ||
| timeout=wake_cfg.timeout, | ||
| single_activation=wake_cfg.single_activation, |
6a41eff to
f21f209
Compare
f21f209 to
65d940d
Compare
Summary by CodeRabbit
New Features