This message was deleted.
# ask-ai
s
This message was deleted.
t
Thanks for reaching out, Brandon. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you clarify if the error occurs consistently for all inputs or only under specific conditions? Additionally, are there any patterns in the inputs that trigger this error, such as empty strings or specific punctuation?
g
So far today, It seems to be very consistent. The error occurs after giving numbers as inputs. It's a bit hard to tell. The conversation items are being added correctly, but I'm capturing the 'error' events using @session.on("error").
t
When you enter numbers, are they coming in on their own or as part of a bigger sentence? Also, if you could let me know how you're formatting or sending the input to the Cartesia TTS system, that would be super helpful. This way, we can figure out what's going on together.
g
This is how the numbers are coming in on @session.on("conversation_item_added")
Copy code
From user: Nineteen seventy.. Interrupted: False
t
The error you're seeing might be because of how numbers like "Nineteen seventy" are being handled. No worries though—here are a couple of ways you can tackle this: 1. Convert Numbers to Words: Try using a built-in function to turn numbers into words before sending them to the TTS system. For example:
Copy code
from livekit.agents import tts
from livekit.plugins import cartesia

def process_text(text):
    # Uses the built-in number to words conversion
    return replace_numbers_with_words(text)
This helps make sure the numbers are formatted just right for TTS. 2. Use a Fallback Adapter: You can also set up a fallback system that smoothly switches to backup TTS providers if the main one runs into trouble:
Copy code
from livekit.agents import tts

   session = AgentSession(
       tts=tts.FallbackAdapter([
           cartesia.TTS(),
           # Additional fallback TTS providers
       ])
   )
This way, it tries the backups and keeps an eye on the main provider’s health. If you want, I’m here to help you get these set up or answer any questions! Sources: tools/tts/tts.cpp | Events and error handling | LiveKit Docs
g
Before diving into this, is it required to pass vad even if I'm already passing turn_detection=MultilingualModel() to the AgentSession?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!