Skip to content

Commit 7881485

Browse files
filler phrase while starting tool call
1 parent 6532504 commit 7881485

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from typing import Dict, Any, List
88
from copy import deepcopy
9+
import random
910
from call_processing.log.logger import logger
1011
from call_processing.services.tool_wrapper_service import ToolWrapperFactory
1112
from call_processing.utils import get_current_ist_time_str
@@ -57,6 +58,7 @@
5758
from call_processing.constants.language_config import (
5859
LANGUAGE_INSTRUCTIONS,
5960
)
61+
from call_processing.constants.filler_phrases import FILLER_PHRASES
6062

6163

6264
class STTLanguageSwitcher(ParallelPipeline):
@@ -519,6 +521,15 @@ async def run_conversation(
519521
task_container['task'] = task
520522

521523
# Register event handlers
524+
@llm.event_handler('on_function_calls_started')
525+
async def on_function_calls_started(service, function_calls):
526+
current_lang = language_state.get('current_language', 'en')
527+
phrases = FILLER_PHRASES.get(
528+
current_lang, FILLER_PHRASES.get('en', ['Please wait a moment'])
529+
)
530+
phrase = random.choice(phrases)
531+
await task.queue_frame(TTSSpeakFrame(phrase))
532+
522533
@transport.event_handler('on_client_connected')
523534
async def on_client_connected(transport, client):
524535
logger.info(f"Client connected for agent: {agent_config['name']}")

0 commit comments

Comments
 (0)