Documentation Index
Fetch the complete documentation index at: https://docs.upliftai.org/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Phrase replacements let you control how specific words and phrases are pronounced. This is useful for:
- Brand names — convert English spellings to Urdu phonetics
- Technical terms — ensure consistent pronunciation
- LLM outputs — fix common misspellings from AI models
- Regional variations — adapt to local dialects
client.tts.phraseReplacements.create(config)
Create a reusable phrase replacement configuration.
import UpliftAI from '@upliftai/sdk-js';
const client = new UpliftAI({
apiKey: 'your-api-key',
});
const config = await client.tts.phraseReplacements.create({
phraseReplacements: [
{ phrase: 'Meezan bank', replacement: 'میزان بینک' },
{ phrase: 'سیونگز اکاؤنٹ', replacement: 'savings account' },
// LLMs sometimes misspell Urdu — "Isabion" is pronounced "Izabiyan"
{ phrase: 'Isabion', replacement: 'ایزابیان' },
],
});
console.log('Config ID:', config.configId);
Using in TTS Requests
Pass the configId to any TTS method:
const { audio } = await client.tts.create({
text: 'Meezan Bank اعتماد کا ضامن',
voiceId: 'v_meklc281',
phraseReplacementConfigId: config.configId,
});
client.tts.phraseReplacements.list()
List all your phrase replacement configurations.
const configs = await client.tts.phraseReplacements.list();
client.tts.phraseReplacements.get(configId)
Fetch a specific configuration by ID.
const config = await client.tts.phraseReplacements.get('config_abc123');
client.tts.phraseReplacements.update(configId, config)
Update an existing configuration.
await client.tts.phraseReplacements.update('config_abc123', [
{ phrase: 'API', replacement: 'اے پی آئی' },
{ phrase: 'SDK', replacement: 'ایس ڈی کے' },
]);