addPronunciation

View as MarkdownOpen in Claude

Add a pronunciation rule that tells the TTS engine how to speak a specific word or phrase. Useful for brand names, acronyms, and technical terms that are commonly mispronounced by text-to-speech engines.

Parameters

rule
PronunciationRuleRequired

A pronunciation rule object with the following fields:

rule.replace
stringRequired

The expression to match in the AI’s output text.

rule.with
stringRequired

The phonetic spelling or alternative text the TTS engine should speak instead.

rule.ignoreCase
boolean

Whether to ignore case when matching the replace expression.

Returns

AgentBase — Returns this for method chaining.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'support', route: '/support' });
4agent.setPromptText('You are a helpful assistant.');
5agent.addPronunciation({ replace: 'SQL', with: 'sequel' });
6agent.addPronunciation({ replace: 'SWAIG', with: 'swig', ignoreCase: true });
7await agent.serve();