Skip to content

feat(misc): voice-chat-widget-with-vercel-sdk + ITN "and" gotcha#54

Closed
abhishekmishragithub wants to merge 4 commits into
mainfrom
misc/voice-chat-widget-sdk-followup
Closed

feat(misc): voice-chat-widget-with-vercel-sdk + ITN "and" gotcha#54
abhishekmishragithub wants to merge 4 commits into
mainfrom
misc/voice-chat-widget-sdk-followup

Conversation

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #53. That PR was squash-merged before these later commits landed, so the SDK twin folder and the README update didn't make it to main.

This PR adds:

  • misc/voice-chat-widget-with-vercel-sdk/ — sibling to the raw-WS folder shipped in feat(misc): voice-chat-widget — raw-WS + Vercel SDK versions #53, same UX but uses smallestai-vercel-provider + ai + @ai-sdk/openai-compatible. STT goes browser-direct via auth: 'query' (no STT proxy); LLM uses streamText; streaming TTS still raw-WS since the SDK does not yet wrap /waves/v1/tts/live. README includes the snake_case → camelCase param mapping table and the auth: 'query'signedUrl production handoff note.
  • misc/voice-chat-widget/README.md — appended ITN gotcha Add blog code sample #8: spoken "and" inside dollar amounts breaks the currency entity ("five hundred and twenty five dollars" → "500 and 25 dollars", not "$525"). Includes the WFST-boundary explanation, two workaround phrasings, and a regex fallback for non-controllable UX.
  • .gitignore in both folders — adds *.tsbuildinfo so TS incremental cache never gets committed.

Test plan

  • cd misc/voice-chat-widget-with-vercel-sdk && cp .env.example .env.local && npm install && npm run dev boots cleanly
  • Hold the mic, say "five hundred twenty five dollars" (no "and") → bubble shows $525
  • Hold the mic, say a phone number → bubble shows hyphenated form
  • DevTools Network → WS request URL contains itn_normalize=true, finalize_on_words=false, eou_timeout_ms=1000
  • SDK emits its own auth: 'query' security warning in proxy logs — by design

End-to-end Next.js example combining all three Smallest products in
parallel: Pulse STT (live transcription with ITN), Electron LLM (OpenAI-
compatible chat-completions streaming), and Lightning v3.1 TTS (streaming
audio over WebSocket). One SMALLEST_API_KEY powers everything.

The README is a deep-dive on the agentic ITN config — finalize_on_words,
eou_timeout_ms, close_stream — that customers most commonly get wrong, with
worked examples (currency, phone numbers, dates, emails, decimals).
…Vercel AI provider

Sibling folder to voice-chat-widget/ but swaps the STT and LLM legs to the
SDK (smallestai-vercel-provider + Vercel ai). STT goes browser-direct via
auth: 'query' so no STT proxy is needed; LLM uses streamText with
@ai-sdk/openai-compatible pointed at Electron. TTS still uses raw WS via a
slimmer proxy.mjs since the SDK does not yet wrap streaming TTS.

The README is the diff vs the raw-WS sibling — same ITN config translated
from snake_case strings to SDK camelCase booleans, same param mapping table,
and a production handoff note about auth: 'query' → signedUrl.
Adds trap #8 to the raw-WS README and a cross-reference in the SDK README.
'five hundred and twenty five dollars' normalizes to '500 and 25 dollars',
not '$525', because Pulse's WFST treats 'and' as a word boundary that
breaks up multi-token cardinal entities. Documents the workaround (drop
the 'and') and a post-process regex for when you can't control phrasing.
@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
smallest-showcase Ready Ready Preview, Comment May 29, 2026 12:50pm

Request Review

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator Author

Closing — conflicting with main because the raw-WS commits were already squash-merged in #53. Reopening as a clean follow-up branched directly off main.

@abhishekmishragithub abhishekmishragithub deleted the misc/voice-chat-widget-sdk-followup branch May 29, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant