From 97fd4e3befbf4b6178e34f192aaaf8d5d55d3d39 Mon Sep 17 00:00:00 2001 From: David vonThenen <12752197+dvonthenen@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:46:15 -0700 Subject: [PATCH] Implement Multilingual --- deepgram/clients/live/v1/response.py | 6 ++++++ deepgram/clients/prerecorded/v1/response.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/deepgram/clients/live/v1/response.py b/deepgram/clients/live/v1/response.py index 52638b07..bf5dcf27 100644 --- a/deepgram/clients/live/v1/response.py +++ b/deepgram/clients/live/v1/response.py @@ -45,6 +45,9 @@ class Word(DataClassJsonMixin): speaker: Optional[int] = field( default=None, metadata=dataclass_config(exclude=lambda f: f is None) ) + language: Optional[str] = field( + default=None, metadata=dataclass_config(exclude=lambda f: f is None) + ) def __getitem__(self, key): _dict = self.to_dict() @@ -66,6 +69,9 @@ class Alternative(DataClassJsonMixin): transcript: str = "" confidence: float = 0 words: List[Word] = field(default_factory=list) + languages: Optional[List[str]] = field( + default=None, metadata=dataclass_config(exclude=lambda f: f is None) + ) def __getitem__(self, key): _dict = self.to_dict() diff --git a/deepgram/clients/prerecorded/v1/response.py b/deepgram/clients/prerecorded/v1/response.py index 31571c49..ad7dc284 100644 --- a/deepgram/clients/prerecorded/v1/response.py +++ b/deepgram/clients/prerecorded/v1/response.py @@ -304,6 +304,9 @@ class Word(DataClassJsonMixin): # pylint: disable=too-many-instance-attributes sentiment_score: Optional[float] = field( default=None, metadata=dataclass_config(exclude=lambda f: f is None) ) + language: Optional[str] = field( + default=None, metadata=dataclass_config(exclude=lambda f: f is None) + ) def __getitem__(self, key): _dict = self.to_dict() @@ -537,7 +540,7 @@ def __str__(self) -> str: @dataclass -class Alternative(DataClassJsonMixin): +class Alternative(DataClassJsonMixin): # pylint: disable=too-many-instance-attributes """ The alternative information for the response. """ @@ -557,6 +560,9 @@ class Alternative(DataClassJsonMixin): translations: Optional[List[Translation]] = field( default=None, metadata=dataclass_config(exclude=lambda f: f is None) ) + languages: Optional[List[str]] = field( + default=None, metadata=dataclass_config(exclude=lambda f: f is None) + ) def __getitem__(self, key): _dict = self.to_dict()