File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
deepgram/clients/listen/v1/websocket Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -93,16 +93,49 @@ def __getitem__(self, key):
9393 return _dict [key ]
9494
9595
96+ @dataclass
97+ class Hit (BaseResponse ):
98+ """
99+ The hit information for the response.
100+ """
101+
102+ confidence : float = 0
103+ start : float = 0
104+ end : float = 0
105+ snippet : Optional [str ] = ""
106+
107+
108+ @dataclass
109+ class Search (BaseResponse ):
110+ """
111+ The search information for the response.
112+ """
113+
114+ query : str = ""
115+ hits : List [Hit ] = field (default_factory = list )
116+
117+ def __getitem__ (self , key ):
118+ _dict = self .to_dict ()
119+ if "hits" in _dict :
120+ _dict ["hits" ] = [Hit .from_dict (hits ) for hits in _dict ["hits" ]]
121+ return _dict [key ]
122+
123+
96124@dataclass
97125class Channel (BaseResponse ):
98126 """
99127 Channel object
100128 """
101129
130+ search : Optional [List [Search ]] = field (
131+ default = None , metadata = dataclass_config (exclude = lambda f : f is None )
132+ )
102133 alternatives : List [Alternative ] = field (default_factory = list )
103134
104135 def __getitem__ (self , key ):
105136 _dict = self .to_dict ()
137+ if "search" in _dict :
138+ _dict ["search" ] = [Search .from_dict (search ) for search in _dict ["search" ]]
106139 if "alternatives" in _dict :
107140 _dict ["alternatives" ] = [
108141 Alternative .from_dict (alternatives )
You can’t perform that action at this time.
0 commit comments