when there is a question somethin regarding confir...
# ask-ai
a
when there is a question somethin regarding confirmation. for example to confirm during the call that am i talkin to the right person, how should such situations be handle on cal to make sure the latency and the accuracy is high on call. i am using gpt40 as llm and sarva for stt and tts
t
Thanks for reaching out, Aryan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you're asking how to handle confirmation prompts on live calls (e.g., “Are you X?”) while keeping latency low and accuracy high using GPT‑4.0 with Sarvam STT/TTS. Below are concise, practical steps you can apply. 1) Prompting & confirmation design • Ask one clear, direct question at a time and prefer yes/no or short-answer formats. • Use a concise agent instruction for confirmations (example: “Ask: ‘Can you please confirm your full name?’ Wait for explicit yes/no or exact phrase before proceeding”). • Keep confirmation responses short to improve STT accuracy. 2) STT tuning (Sarvam) • Set the correct language/locale (e.g.,
en-IN
) to improve recognition. • Use Sarvam’s optimized real-time model (recommended
saarika:v2.5
) for lower latency and higher accuracy. • If available, enable endpointing/turn-detection features in Sarvam so the agent knows when the speaker finished. 3) Turn detection & end-of-turn handling • Use a reliable turn detector (e.g., LiveKit’s MultilingualModel) so you avoid cutting users off or waiting too long. • Configure sensitivity so the detector favors not truncating user speech (slightly conservative end-of-turn) for confirmations. 4) Latency reduction techniques • Enable preemptive generation so GPT‑4.0 can begin composing as partial transcription arrives. • Co-locate your agent server with Sarvam and your LLM endpoint to reduce network RTT. • Monitor Time‑To‑First‑Token (LLM) and TTFB (TTS) and optimize the slowest hop. 5) TTS behavior • Use a clear, moderate-paced voice and short confirmation prompts to minimize synthesis time and improve listener comprehension. • If possible, synthesize partial responses quickly (short confirmations) rather than long prompts. 6) Validation & observability • Record and review traces for STT → LLM → TTS timing to find bottlenecks. • Replay examples of confirmation flows to check accuracy and adjust prompt phrasing, STT model, or turn detector settings. 7) Safety & fallback • If STT confidence is low, ask the confirmation once more in a short form or request a typed confirmation if the channel allows. • For critical confirmations, require a second verification (different phrasing) or a follow-up short code readback. If you want, I can: • Suggest a short confirmation prompt template for your agent. • Show example session config code for enabling preemptive generation + Sarvam STT settings. Which would you like next? Sources: Prompting guide | LiveKit docs | Sarvam STT plugin guide | LiveKit Docs | OpenAI TTS plugin guide | LiveKit docs | Agent speech and audio | LiveKit docs | LiveKit turn detector plugin | LiveKit docs
a
give me an exmaple of sarvam stt settings
t
Below is a concise example configuration for Sarvam STT optimized for confirmations: correct locale, low-latency streaming model, and endpointing/confidence options.
Copy code
# Example: Sarvam STT session configuration (Python-style pseudocode)
from sarvam import STT

stt = STT(
    model="saarika:v2.5",          # low-latency, high-accuracy real-time model
    language="en-IN",              # set locale for better recognition
    sample_rate=16000,             # match common telephony/WebRTC rate
    channel_count=1,               # mono audio for voice calls
    enable_endpointing=True,       # detect end-of-turn to avoid cutting off user
    endpoint_silence_ms=450,       # consider speech ended after ~450ms silence
    partial_results=True,          # receive interim transcripts for preemptive LLM use
    max_alternatives=3,            # return top N hypotheses for higher confirmation accuracy
    profanity_filter=False,        # set per your use case
    vad_mode="conservative",       # voice activity detection mode; conservative avoids truncation
    confidence_threshold=0.7       # use returned confidence to trigger re-confirmation if low
)

# Example usage (streaming):
for audio_chunk in microphone.stream():
    resp = stt.stream_audio(audio_chunk)
    if resp.partial:
        handle_partial_transcript(resp.text)
    if resp.final:
        handle_final_transcript(resp.text, resp.confidence, resp.alternatives)
Notes: • Use
partial_results=True
plus preemptive generation so GPT‑4 can start composing before final transcript arrives. • Use
max_alternatives
and
confidence_threshold
to decide when to re-ask confirmations (e.g., if confidence < 0.7, prompt again). • Tune
endpoint_silence_ms
and
vad_mode
based on call environment (noisy vs. quiet) to balance latency vs. truncation. Want this in another language (Node/JS) or an exact API call for your setup?