From f91873d481e3d699dc0c060c4c3963547ed52429 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 26 Jun 2026 17:08:02 +0200 Subject: [PATCH] fix(listen/v2): allow extra fields on Flux TurnInfo models MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flux (flux-general-en) now returns additional per-word fields `start` and `end` (type double) on every word in a `TurnInfo` message — see the Flux API reference. The 5.3.x socket models declare only `word`/`confidence` with `extra = "forbid"`, so each TurnInfo frame fails pydantic validation in `listen/v2/socket_client.py` (`parse_obj_as(V2SocketClientResponse, ...)`). On 5.3.0 this raises an uncaught ValidationError that tears down `start_listening()` (it only catches WebSocketException/JSONDecodeError); on 5.3.2/5.3.3 (construct_type) the frame is silently mis-resolved to `ListenV2ConnectedEvent`, dropping the transcript and words. Relax `extra` to "allow" on `ListenV2TurnInfoEventWordsItem` and `ListenV2TurnInfoEvent` so unknown additive fields are tolerated (and retained), matching the `extra="allow"` posture already shipped on main (6.x/7.x). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../extensions/types/sockets/listen_v2_turn_info_event.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/deepgram/extensions/types/sockets/listen_v2_turn_info_event.py b/src/deepgram/extensions/types/sockets/listen_v2_turn_info_event.py index ab099dd9..80eb5033 100644 --- a/src/deepgram/extensions/types/sockets/listen_v2_turn_info_event.py +++ b/src/deepgram/extensions/types/sockets/listen_v2_turn_info_event.py @@ -19,7 +19,7 @@ def dict(self, **kwargs) -> dict: class Config: frozen = True - extra = "forbid" + extra = "allow" class ListenV2TurnInfoEvent(UniversalBaseModel): @@ -44,4 +44,4 @@ def dict(self, **kwargs) -> dict: class Config: frozen = True - extra = "forbid" + extra = "allow"