import { ContextBuilder } from '@signalwire/sdk';
const builder = new ContextBuilder();
const main = builder.addContext('default');
main.addStep('menu').setText('Ask whether the caller needs sales or support.');
const support = builder.addContext('support');
// System prompt for this context
support.setSystemPrompt('You are a patient technical support engineer.');
support.setConsolidate(true);
// Fillers for smooth transitions
support.addEnterFiller('en-US', [
'Let me connect you with support...',
'Transferring you now...',
]);
support.addExitFiller('en-US', [
'Thank you for contacting support.',
'Glad I could help.',
]);
// Navigation
support.setValidContexts(['default']);
// Steps
support.addStep('diagnose', {
task: 'Understand the customer\'s issue and gather relevant details.',
criteria: 'Issue is clearly identified',
functions: ['lookup_account', 'check_status'],
validSteps: ['resolve'],
});
support.addStep('resolve', {
task: 'Resolve the issue or escalate to a specialist.',
functions: ['create_ticket', 'transfer_call'],
validSteps: ['farewell'],
});
support.addStep('farewell')
.setText('Thank the caller and end the conversation.')
.setFunctions('none')
.setEnd(true);