Commit e5ba91b
authored
Add on_start support to VoiceWorkflowBase and VoicePipeline (#922)
I added an optional `on_start()` method to `VoiceWorkflowBase`, allowing
voice workflows to emit an initial TTS message before any user input.
This aligns with the usage pattern suggested in #488
The `VoicePipeline._run_multi_turn()` method was updated to call this
hook and stream any yielded messages via TTS before transcription
begins. No changes are required to existing workflows, as the method
defaults to returning an empty `AsyncIterator[str]`.
Resolves #488 and thus improves UX for voice agents that need to greet
or instruct users proactively. All tests pass under Python 3.12. Let me
know if you'd like an example workflow or docs added in a follow-up!1 parent d1d2ecc commit e5ba91b
2 files changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
| |||
0 commit comments