Repository navigation
Stop the OMIT sentinel from reaching the realtime TTS connection - #858
Conversation
…ction model_id and voice_settings both default to OMIT, which is Ellipsis. Ellipsis is truthy, so `voice_settings.dict() if voice_settings else None` called .dict() on the sentinel and raised AttributeError at the documented default call. model_id was passed straight into build_ws_url, where urlencode stringified it into model_id=Ellipsis. Normalize both sentinels to None and filter the query params with the remove_none_from_dict already imported in this file, matching how realtime/scribe.py and conversational_ai/conversation.py build theirs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PR SummaryLow Risk Overview Before opening the connection, Adds Reviewed by Cursor Bugbot for commit b93c137. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Thanks for the contribution, but the file you've edited is autogenerated so your changes will be overwritten the next time we generate the SDKs. Instead this needs to be fixed upstream in the generator, so I'm closing this for now. |
|
Thanks for taking a look, and no problem either way. I think this one may be a false alarm
The file does still carry the "auto-generated by Fern" header, which is what I suspect
So a human edit to this file has already survived a regeneration cycle. Happy to be wrong here. If the OMIT handling really does originate in the generator I'll |
|
You're absolutely right, sorry about that. Will look at this again in more detail. |
convert_realtimeraisesAttributeError: 'ellipsis' object has no attribute 'dict'at its documented default, before it sends any text.model_idandvoice_settingsboth default toOMIT, which isEllipsis. Line 115 isvoice_settings.dict() if voice_settings else None, andEllipsisis truthy, so.dict()is called on the sentinel.The same sentinel reaches the URL.
model_idgoes straight intobuild_ws_url, whereurlencodestringifies it, so a caller who passesvoice_settingsbut omitsmodel_idconnects tostream-input?model_id=Ellipsis&output_format=mp3_44100_128instead of letting the server apply its default. This predates thebuild_ws_urlrefactor in #780; the old f-string produced the same query string.realtime/scribe.pyandconversational_ai/conversation.pyboth build their params conditionally. This does the same, reusing theremove_none_from_dictalready imported in this file.Four of the six added tests fail on
main. The suite goes from 189 to 195 passed, with the same 16 live-API failures on either side, andmypyis clean. Both files touched are listed in.fernignore. I left the pre-existingruffimport-order warning in this file alone rather than bury a six line fix.