{"id":24583781,"url":"https://github.com/assemblyai-solutions/realtimespellcheck","last_synced_at":"2025-10-19T11:19:10.772Z","repository":{"id":210789782,"uuid":"721801069","full_name":"AssemblyAI-Solutions/RealtimeSpellCheck","owner":"AssemblyAI-Solutions","description":"This script integrates a LLM into the AssemblyAI Real-Time API to correct spelling errors in real-time. The script is currently configured to correct dish names for an online food ordering service.","archived":false,"fork":false,"pushed_at":"2023-11-21T19:57:42.000Z","size":16636,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T04:53:33.377Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AssemblyAI-Solutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-21T19:50:50.000Z","updated_at":"2024-12-06T22:59:30.000Z","dependencies_parsed_at":"2023-12-05T00:11:39.448Z","dependency_job_id":"8780df01-62fe-4979-a038-fead01750617","html_url":"https://github.com/AssemblyAI-Solutions/RealtimeSpellCheck","commit_stats":null,"previous_names":["assemblyai-solutions/realtimespellcheck"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI-Solutions%2FRealtimeSpellCheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI-Solutions%2FRealtimeSpellCheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI-Solutions%2FRealtimeSpellCheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI-Solutions%2FRealtimeSpellCheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AssemblyAI-Solutions","download_url":"https://codeload.github.com/AssemblyAI-Solutions/RealtimeSpellCheck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244076057,"owners_count":20394049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-24T04:53:42.022Z","updated_at":"2025-10-19T11:19:10.659Z","avatar_url":"https://github.com/AssemblyAI-Solutions.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real-Time LLM Spell Checker\n\n### Overview\nThis script integrates a LLM into the AssemblyAI Real-Time API to correct spelling errors in real-time. The script is currently configured to correct dish names for an online food ordering service.\n\n### Steps\n1. Install the required packages in requirements.txt\n2. Create a .env file with your `OPENAI_API_KEY` and `ASSEMBLYAI_API_KEY`\n2. Transcode the files you want to transcribe (requires FFMPEG)\n3. Add your menu items to menu.txt\n4. Run the script `python transcript.py \u003caudio_file_path\u003e`\n\n### Files\n1. **transcript.py:** Creates websocket and streams audio to AssemblyAI API.\n2. **llm.py:** Makes call to LLM and returns corrected utterance.\n3. **transcode.py:** Transcodes audio files to the required PCM 16bit format.\n4. **menu.txt:** List of menu items to use as reference for LLM.\n\n### Notes\n[1] This script uses our Real-Time confidence scoring to identify the potential misspellings. Ironically this aligns pretty well with the dish names that are being mis-transcribed (the words in red in the screenshot below all have confidence scores below 0.5)\n\n![screenshot](./screenshot.png)\n\n[2] Using an LLM, we can try to correct these misspellings in real-time. We can provide the LLM the correct spellings of the dish names as reference.\n\n[3] Overall, this solution would be fairly cheap to implement. For example I used GPT 3.5 Turbo in the demo below and averaged the total cost out to be ~$0.0008 per 2 minute call. To save on cost / latency, we only make the LLM call if a low-confidence word is detected in the utterance. So essentially the LLM is only used as backup and can be toggled on or off depending on restaurant / cuisine (customer mentioned Chinese \u0026 Japanese dishes were the most difficult to transcribe)\n\n[4] Latency may be a slight concern here. Depending on OpenAI's system traffic levels, the LLM call can take anywhere from 1-5 seconds to return the corrected utterance. IMO, this added latency worth it if it fixes the downstream dish detection issue. I have a few ideas on ways we can try to reduce this including fine-tuning a smaller model (davinci-003) or combining the spell correction + dish detection NER processes. Sadly, LeMUR won't be a viable option here as the latency is just too long to be used in a Real-Time setting.\n\n### Demo\nhttps://github.com/AssemblyAI-Solutions/RealtimeSpellCheck/assets/106788596/83df6f05-ece4-49ba-839d-d79022aafe93\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemblyai-solutions%2Frealtimespellcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassemblyai-solutions%2Frealtimespellcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemblyai-solutions%2Frealtimespellcheck/lists"}