best-van-73181
09/25/2025, 2:47 PMrefined-appointment-81829
09/25/2025, 2:50 PMsmart_format to true when initializing the STT instance. Here’s an example of how to do this in Python:
stt = deepgram.STT(smart_format=True)
This should help improve the consistency of how numbers are transcribed from speech to text.
2. Post-Processing: If Smart Formatting does not yield consistent results, you might need to implement a post-processing step after receiving the transcription from Deepgram. You can use regular expressions to identify patterns that match the expected format of authorization numbers and convert them back to their numeric form. For example:
import re
def convert_to_number(transcription):
# Example regex to match the pattern of numbers spelled out
pattern = r"(?:(nine|zero|one|two|three|four|five|six|seven|eight|nine)\s*)+"
matches = re.findall(pattern, transcription)
# Convert matches to numeric form
for match in matches:
# Implement conversion logic here
pass
return transcription # Return modified transcription
3. LLM Configuration: Ensure that the LLM (Anthropic's Claude Sonnet 4 in your case) is configured to handle numeric inputs effectively. You might need to provide it with specific instructions or context to treat certain phrases as numbers rather than text. This can be done by including examples in the prompt that clarify how to interpret authorization numbers.
4. Testing and Iteration: Since this is a critical process, it’s essential to test various configurations and approaches. Monitor the performance of the STT and LLM in different scenarios to identify what works best for your use case.
By combining these strategies, you should be able to improve the handling of authorization numbers in your LiveKit agent using Deepgram for STT and TTS.
Notes:
• Make sure to check the Deepgram documentation for the latest features and best practices regarding Smart Formatting.
• The regex pattern provided is a simple example; you may need to adjust it based on the specific formats of authorization numbers you expect to encounter.
• Consider logging the outputs at each stage to help diagnose any further issues with the transcription and processing pipeline.best-van-73181
09/25/2025, 2:59 PMrefined-appointment-81829
09/25/2025, 3:21 PMrefined-appointment-81829
09/25/2025, 3:22 PMrefined-appointment-81829
09/25/2025, 3:23 PMrefined-appointment-81829
09/25/2025, 3:24 PMrefined-appointment-81829
09/25/2025, 3:24 PMbest-van-73181
09/25/2025, 3:30 PM