Skip to content

Commit c22cc40

Browse files
filler phrase while starting tool call (#232)
* filler phrase while starting tool call * skip tts phrase when lang switches * removed periods from filler phrases * added env var ENABLE_FILLER_PHRASES_BEFORE_TOOL_CALL * made step to 0.01 for voice provider config
1 parent 28899bd commit c22cc40

File tree

3 files changed

+64
-9
lines changed

3 files changed

+64
-9
lines changed

wavefront/client/src/config/voice-providers.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,23 @@ export const VOICE_PROVIDERS_CONFIG: VoiceProvidersConfig = {
7070
default: 0.5,
7171
min: 0,
7272
max: 1,
73-
step: 0.05,
73+
step: 0.01,
7474
description: 'Controls voice consistency (0-1)',
7575
},
7676
similarity_boost: {
7777
type: 'number',
7878
default: 0.75,
7979
min: 0,
8080
max: 1,
81-
step: 0.05,
81+
step: 0.01,
8282
description: 'Enhances voice similarity (0-1)',
8383
},
8484
style: {
8585
type: 'number',
8686
default: 0.0,
8787
min: 0,
8888
max: 1,
89-
step: 0.05,
89+
step: 0.01,
9090
description: 'Style exaggeration (0-1)',
9191
},
9292
use_speaker_boost: {
@@ -99,7 +99,7 @@ export const VOICE_PROVIDERS_CONFIG: VoiceProvidersConfig = {
9999
default: 1.0,
100100
min: 0.25,
101101
max: 4.0,
102-
step: 0.05,
102+
step: 0.01,
103103
description: 'Speech speed (0.25-4.0)',
104104
},
105105
},
@@ -155,7 +155,7 @@ export const VOICE_PROVIDERS_CONFIG: VoiceProvidersConfig = {
155155
default: undefined,
156156
description: 'Speech speed multiplier',
157157
placeholder: '1.0',
158-
step: 0.1,
158+
step: 0.01,
159159
},
160160
},
161161
},
@@ -183,23 +183,23 @@ export const VOICE_PROVIDERS_CONFIG: VoiceProvidersConfig = {
183183
default: 0.0,
184184
min: -0.75,
185185
max: 0.75,
186-
step: 0.05,
186+
step: 0.01,
187187
description: 'Voice pitch (-0.75 to 0.75)',
188188
},
189189
pace: {
190190
type: 'number',
191191
default: 1.0,
192192
min: 0.3,
193193
max: 3.0,
194-
step: 0.1,
194+
step: 0.01,
195195
description: 'Speech pace (0.3-3.0)',
196196
},
197197
loudness: {
198198
type: 'number',
199199
default: 1.0,
200200
min: 0.1,
201201
max: 3.0,
202-
step: 0.1,
202+
step: 0.01,
203203
description: 'Volume (0.1-3.0)',
204204
},
205205
enable_preprocessing: {
@@ -212,7 +212,7 @@ export const VOICE_PROVIDERS_CONFIG: VoiceProvidersConfig = {
212212
default: 0.6,
213213
min: 0.01,
214214
max: 1.0,
215-
step: 0.05,
215+
step: 0.01,
216216
description: 'Randomness for bulbul v3 (0.01-1.0)',
217217
},
218218
},
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FILLER_PHRASES = {
2+
'en': [
3+
'Please wait a moment',
4+
'Just a second',
5+
'Give me a moment',
6+
'One moment please',
7+
],
8+
'hi': ['कृपया एक पल प्रतीक्षा करें', 'बस एक सेकंड', 'मुझे एक पल दें', 'एक पल रुकिए'],
9+
'ta': [
10+
'தயவுசெய்து ஒரு நிமிடம் காத்திருக்கவும்',
11+
'ஒரு நொடி',
12+
'எனக்கு ஒரு நிமிடம் கொடுங்கள்',
13+
'ஒரு நிமிடம்',
14+
],
15+
'te': [
16+
'దయచేసి ఒక్క క్షణం వేచి ఉండండి',
17+
'ఒక్క నిమిషం',
18+
'నాకు ఒక్క క్షణం ఇవ్వండి',
19+
'ఒక్క క్షణం దయచేసి',
20+
],
21+
'ml': [
22+
'ദയവായി ഒരു നിമിഷം കാത്തിരിക്കൂ',
23+
'ഒരു സെക്കൻഡ്',
24+
'എനിക്ക് ഒരു നിമിഷം തരൂ',
25+
'ഒരു നിമിഷം ദയവായി',
26+
],
27+
'kn': [
28+
'ದಯವಿಟ್ಟು ಒಂದು ಕ್ಷಣ ಕಾಯಿರಿ',
29+
'ಒಂದು ಕ್ಷಣ',
30+
'ನನಗೆ ಒಂದು ಕ್ಷಣ ನೀಡಿ',
31+
'ಒಂದು ಕ್ಷಣ ದಯವಿಟ್ಟು',
32+
],
33+
}

wavefront/server/apps/call_processing/call_processing/services/pipecat_service.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from typing import Dict, Any, List
88
from copy import deepcopy
9+
import os
10+
import random
911
from call_processing.log.logger import logger
1012
from call_processing.services.tool_wrapper_service import ToolWrapperFactory
1113
from call_processing.utils import get_current_ist_time_str
@@ -57,6 +59,7 @@
5759
from call_processing.constants.language_config import (
5860
LANGUAGE_INSTRUCTIONS,
5961
)
62+
from call_processing.constants.filler_phrases import FILLER_PHRASES
6063

6164

6265
class STTLanguageSwitcher(ParallelPipeline):
@@ -519,6 +522,25 @@ async def run_conversation(
519522
task_container['task'] = task
520523

521524
# Register event handlers
525+
@llm.event_handler('on_function_calls_started')
526+
async def on_function_calls_started(service, function_calls):
527+
if (
528+
os.getenv('ENABLE_FILLER_PHRASES_BEFORE_TOOL_CALL', '').lower()
529+
!= 'true'
530+
):
531+
return
532+
# Skip filler phrase when language is switching — the TTS service's language
533+
# may change before the queued frame is processed, causing a language mismatch error.
534+
call_names = [fc.function_name for fc in function_calls]
535+
if 'detect_and_switch_language' in call_names:
536+
return
537+
current_lang = language_state.get('current_language', 'en')
538+
phrases = FILLER_PHRASES.get(current_lang)
539+
if not phrases:
540+
return
541+
phrase = random.choice(phrases)
542+
await task.queue_frame(TTSSpeakFrame(phrase))
543+
522544
@transport.event_handler('on_client_connected')
523545
async def on_client_connected(transport, client):
524546
logger.info(f"Client connected for agent: {agent_config['name']}")

0 commit comments

Comments
 (0)