SOmething seems wrong with the syntax, what is it:...
# ask-ai
d
SOmething seems wrong with the syntax, what is it: const session = new voice.AgentSession({ tts: new elevenlabs.TTS( voice_id: "ODq5zmih8GrVes37Dizd", model: "eleven_multilingual_v2" ),
t
Thanks for reaching out, Simeon. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're very close — the issue is the missing object literal when calling the constructor. Wrap the parameters in curly braces. Corrected snippet:
Copy code
const session = new voice.AgentSession({
  tts: new elevenlabs.TTS({
    voice_id: "ODq5zmih8GrVes37Dizd",
    model: "eleven_multilingual_v2"
  }),
  // ...other config
});
Would you like me to check the rest of the session config for any other issues? Sources: ElevenLabs TTS plugin guide | LiveKit Docs
d
failed to solve: process "/bin/sh -c pnpm build" did not complete successfully: exit code: 2
t
You're seeing a generic failure for
pnpm build
(exit code 2). To diagnose it I need the build output — the specific error lines from the
pnpm build
run (or the Docker build log around where the failure happens). Please share: • The full error log from the failing
pnpm build
step (copy/paste the stderr lines). • Your
package.json
(the
scripts
section) and
tsconfig.json
if using TypeScript. • Your Dockerfile (or the exact commands you run) and confirm you run
pnpm install
before
pnpm build
. • Any recent changes you made before the failure. Once I have those I’ll pinpoint the cause (missing build script, TypeScript errors, missing deps, wrong WORKDIR, etc.) and give exact fixes. Would you like instructions for extracting the Docker build logs if needed? Sources: Builds and Dockerfiles | LiveKit Docs
d
src/agent.ts16514 - error TS1005: ',' expected. 165 voice: { id: "ODq5zmih8GrVes37Dizd" }, ~ src/agent.ts16614 - error TS1005: ',' expected. 166 model: "eleven_multilingual_v2" ~ Found 2 errors in the same file, starting at: src/agent.ts:165
t
You're seeing TypeScript syntax errors because the
voice
and
model
properties are written outside an object literal. The compiler expects commas/curly braces. Fix by passing an object to
tts
(wrap properties in
{}
) — for example:
Copy code
const session = new voice.AgentSession({
  tts: new elevenlabs.TTS({
    voice: { id: "ODq5zmih8GrVes37Dizd" },
    model: "eleven_multilingual_v2",
  }),
  // ...other config
});
If you previously used
voice: { id: ... }
and
model: ...
at the same indentation level without the surrounding
{}
for the
elevenlabs.TTS
call, that produces the TS1005 errors you posted. After making this change, run
pnpm build
again. If you still get errors, paste the updated TypeScript error output and the surrounding lines (~10 lines) from
src/agent.ts
and I’ll pinpoint the next fix.
d
src/agent.ts1679 - error TS2739: Type '{ id: string; }' is missing the following properties from type 'Voice': name, category 167 voice: { id: "ODq5zmih8GrVes37Dizd" }, ~~~~~ Found 1 error in src/agent.ts:167  ELIFECYCLE  Command failed with exit code 2. -- entry: async (ctx: JobContext) => { // Set up a voice AI pipeline using OpenAI, Cartesia, AssemblyAI, and the LiveKit turn detector const session = new voice.AgentSession({ tts: new elevenlabs.TTS({ voice: { id: "ODq5zmih8GrVes37Dizd" }, model: "eleven_multilingual_v2", }), turnDetection: new livekit.turnDetector.MultilingualModel(), stt: new deepgram.STT({ model: 'nova-3', language: 'de', }), vad: await silero.VAD.load(), llm: new inference.LLM({ model: 'openai/gpt-4.1-mini', }), });
t
Good — the TypeScript error means the
Voice
type requires more than
id
. You can fix it two ways. Option 1 — pass the voice as a string ID:
Copy code
tts: new elevenlabs.TTS({
  voice: "ODq5zmih8GrVes37Dizd",
  model: "eleven_multilingual_v2",
}),
Option 2 — provide the full
Voice
object including
name
and `category`:
Copy code
tts: new elevenlabs.TTS({
  voice: {
    id: "ODq5zmih8GrVes37Dizd",
    name: "Voice Name",
    category: "premade" // or "cloned", etc.
  },
  model: "eleven_multilingual_v2",
}),
Apply one of these, run
pnpm build
again, and paste any new errors (or ~10 lines around them) if it still fails. Would you like me to suggest a likely `name`/`category` for that voice ID? Sources: ElevenLabs TTS plugin guide | LiveKit Docs | ElevenLabs TTS | LiveKit Docs
d
great. works now with the second one. How do I add speed and text normalization and a dict?
t
Great — glad that fixed it. Regarding speed, text normalization, and a pronunciation dictionary, you have two clean options depending on whether you’re using the ElevenLabs plugin or LiveKit Inference. Pick the one that matches your setup. Option A — ElevenLabs plugin (full control, SSML support)
Copy code
tts: new elevenlabs.TTS({
  voice: {
    id: "ODq5zmih8GrVes37Dizd",
    name: "Voice Name",
    category: "premade"
  },
  model: "eleven_multilingual_v2",
  voice_settings: {
    speed: 1.25   // 1.0 = normal, >1 faster, <1 slower
  },
  enable_ssml_parsing: true
})
• Speed: set via
voice_settings.speed
. • Text normalization & pronunciation: send SSML in your text (e.g.
<say-as>
and
<phoneme>
). Example:
Copy code
await session.say('<speak>Call me at <say-as interpret-as="telephone">123-456-7890</say-as>.</speak>');
// phoneme example:
await session.say('<speak>The word <phoneme alphabet="ipa" ph="fɪziʃ">physics</phoneme>.</speak>');
• Use SSML for dictionary-like overrides (phonemes) and number/date normalization. Option B — LiveKit Inference TTS (managed modelOptions)
Copy code
tts: new inference.TTS({
  model: "elevenlabs/eleven_multilingual_v2",
  voice: "ODq5zmih8GrVes37Dizd",
  language: "en",
  modelOptions: {
    speed: 1.25,
    apply_text_normalization: true
  }
})
• Speed:
modelOptions.speed
. • Text normalization:
apply_text_normalization: true
. • No explicit dict field — use SSML (`<phoneme>`/`<say-as>`) in the text for pronunciation control. Which one are you using (plugin or inference)? I can give a copy-paste-ready snippet for your project and an SSML example tailored to your text if you want. Sources: ElevenLabs TTS plugin guide | LiveKit Docs
d
How do I use text normalization or speed into the elevenlabs inference? }, voice_settings: { speed: 1.25 }, modelI this does not work
t
You're mixing plugin options with the Inference API. Quick answers: • Text normalization in Inference: supported. Use
modelOptions
(Node) or
extra_kwargs
(Python) and set
apply_text_normalization: true
. • Speed in Inference: not supported. Use the ElevenLabs plugin to set
voice_settings.speed
. Node.js example for text normalization with Inference:
Copy code
tts: new inference.TTS({
  model: "elevenlabs/eleven_multilingual_v2",
  voice: "ODq5zmih8GrVes37Dizd",
  modelOptions: {
    apply_text_normalization: true
  }
})
If you need speed control, switch to the plugin and use:
Copy code
tts: new elevenlabs.TTS({
  voice: { id: "ODq5zmih8GrVes37Dizd", name: "Voice Name", category: "premade" },
  model: "eleven_multilingual_v2",
  voice_settings: { speed: 1.25 },
  enable_ssml_parsing: true
})
Which setup are you using (Inference or plugin)? I can provide the exact snippet for your project. Sources: ElevenLabs TTS | LiveKit Docs | ElevenLabs TTS plugin guide | LiveKit Docs
d
plugin
t
Great — since you’re using the ElevenLabs plugin, here’s how to add speed, enable SSML/text normalization, and provide dictionary-like pronunciation using phonemes. 1) Plugin TTS config (Node)
Copy code
tts: new elevenlabs.TTS({
  voice: {
    id: "ODq5zmih8GrVes37Dizd",
    name: "Voice Name",
    category: "premade"
  },
  model: "eleven_multilingual_v2",
  voice_settings: {
    speed: 1.25
  },
  enable_ssml_parsing: true
})
•
voice_settings.speed
controls playback speed (1.0 = normal). •
enable_ssml_parsing: true
lets the TTS interpret SSML for normalization and pronunciation. 2) Use SSML for text normalization and custom pronunciations • Numbers, dates, telephone, etc.: use <say-as> • Custom pronunciation: use <phoneme> with IPA or another supported alphabet Examples:
Copy code
await session.say('<speak>Call <say-as interpret-as="telephone">123-456-7890</say-as>.</speak>');

await session.say('<speak>The word <phoneme alphabet="ipa" ph="fɪziʃ">physics</phoneme> is tricky.</speak>');
3) Tips • Keep
enable_ssml_parsing
true when sending SSML. • For many normalization cases (<say-as>), SSML is enough; ElevenLabs plugin will apply it. • If you want a programmatic “dictionary,” translate entries into phoneme-wrapped replacements before sending text (replace terms with SSML phoneme tags). If you want, tell me one sample phrase and the pronunciation you want changed and I’ll give the exact SSML string to use.