Our transcripts look like that — Any way to have i...
# ask-ai
w
Our transcripts look like that — Any way to have it in one phrase?? We tried changing the STT endpoint to be 300ms to be more conservative —but it still happening!
t
Thanks for reaching out, Ahmed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you please share which Speech-to-Text (STT) provider you're using? That way, I can better guide you on the right settings to help combine phrases into single blocks. I'm here to help you every step of the way!
w
Our transcript looks like One two three four five instead of One two three four five We’re using deepgrma
t
To help you with the issue of split transcripts in Deepgram, here are a few settings you might find useful to tweak: • Endpointing: Try increasing the silence threshold before the speech is finalized. For instance, setting
endpointing_ms
to 1000ms (1 second) or more can help group longer phrases together. • Disable Interim Results: Setting
interim_results
to
False
ensures you receive only the complete, final transcriptions, which might make things clearer. • Enable Smart Formatting and Punctuation: Using
punctuate=True
and
smart_format=True
can really improve the readability and flow of your transcripts. Here’s a friendly example configuration in Python to get you started:
Copy code
from livekit.plugins import deepgram

stt = deepgram.STT(
    interim_results=False,      # No partial results
    punctuate=True,            # Add punctuation
    smart_format=True,         # Format numbers/dates
    endpointing_ms=1500,       # 1.5 seconds of silence before finalizing
    filler_words=False         # Remove "um", "uh" for cleaner blocks
)
Feel free to adjust the endpointing_ms value based on what works best for you. And of course, if you have any questions or need a hand with anything else, I’m here to help! Sources: examples/voice_agents/realtime_turn_detector.py
w
Still breaking it into 3 lines if it’s long! and the llm gets confused
t
To help prevent Deepgram STT from breaking long phrases into multiple lines, you might find these settings really useful: • Increase Endpointing: Try setting
endpointing_ms
to a higher value, like 300ms or more. This allows the system to tolerate longer pauses before finalizing speech, which can make a big difference. • Disable Interim Results: Setting
interim_results=False
means you'll only get complete, final transcripts. This helps reduce fragmentation, though it might add a bit of latency. • Enable Smart Formatting and Punctuation: Using
punctuate=True
and
smart_format=True
can really improve how coherent and well-structured the output feels. Here’s a friendly example configuration in Python to get you started:
Copy code
from livekit.plugins import deepgram

stt = deepgram.STT(
    interim_results=False,      # Only final results
    punctuate=True,            # Add punctuation
    smart_format=True,         # Format numbers/dates
    endpointing_ms=300         # Tolerate longer pauses
)
If you find the issue is still happening, you can always try increasing endpointing_ms even more—maybe to 500ms or 1000ms—to better handle longer phrases. Please feel free to reach out if you want a hand with this or anything else! I’m here to help. Sources: plugins/deepgram/src/stt.ts | Deepgram STT | LiveKit Docs | livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt_v2.py
w
I have done that. Can I do anything about grouping the text together before sending it to LLM ?
t
To group Deepgram STT transcripts into single blocks before sending them to the LLM, you can create a custom grouping logic in your LiveKit agent. I’d be happy to guide you through how to do this: • Override the STT Node: You can customize the
stt_node
method in your agent to buffer and group transcripts before finalizing them. For instance, collect
FINAL_TRANSCRIPT
events and group them until an
END_OF_SPEECH
event happens. • Time-Based Grouping: Consider using a time threshold (like 1.5 seconds of silence) to decide when to finalize and send the grouped transcripts. • Speaker-Based Grouping: If it fits your use case, grouping transcripts by speaker ID can help keep the context clear. Here’s an example implementation in Python that might help:
Copy code
class GroupingAgent(Agent):
    async def stt_node(self, audio, model_settings):
        parent_stt_stream = Agent.default.stt_node(self, audio, model_settings)
        transcript_buffer = []
        async for event in parent_stt_stream:
            if event.type == stt.SpeechEventType.FINAL_TRANSCRIPT:
                if event.alternatives:
                    transcript_buffer.append(event.alternatives[0].text)
                continue
            elif event.type == stt.SpeechEventType.END_OF_SPEECH:
                if transcript_buffer:
                    grouped_text = " ".join(transcript_buffer)
                    # Send grouped_text to LLM or process further
                    transcript_buffer.clear()
                yield event
            else:
                yield event
This method helps make sure that fragmented transcripts come together as clear, coherent blocks before reaching the LLM. If you have any questions or want help implementing this, please don’t hesitate to ask—I’m here to support you! Sources: Pipeline nodes and hooks | LiveKit Docs | livekit-plugins/livekit-plugins-gladia/livekit/plugins/gladia/stt.py | docs/index.yaml
w
what to do with grouped_text = ” “.join(transcript_buffer) ?
t
The line grouped_text = " ".join(transcript_buffer) gently brings together all the little pieces of text you've collected in transcript_buffer, joining them into one smooth, flowing string separated by spaces. This way, you get a clear, coherent block of text that’s ready for you to work with or send off to the LLM. For instance, if your transcript_buffer holds ["Hello", "how are you", "today"], then grouped_text will beautifully become "Hello how are you today". Once you have your grouped_text, here are some friendly next steps you might consider: • Send it over to the LLM for some processing magic. • Keep a log or store it safely for debugging or later analysis. • Give it a little extra formatting or processing if you feel like it. If you’d like, I’m here to help you with whatever comes next for using grouped_text—just let me know!
w
How I can do that.. I don’t see you calling the llm
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!