@@ -218,8 +218,6 @@ def __getitem__(self, key):
218218 _dict ["voice" ] = [
219219 CartesiaVoice .from_dict (voice ) for voice in _dict ["voice" ]
220220 ]
221- if "language" in _dict :
222- _dict ["language" ] = [str (language ) for language in _dict ["language" ]]
223221 return _dict [key ]
224222
225223
@@ -242,14 +240,14 @@ class Think(BaseResponse):
242240
243241 def __getitem__ (self , key ):
244242 _dict = self .to_dict ()
245- if "provider" in _dict :
246- _dict ["provider" ] = [
247- ThinkProvider .from_dict (provider ) for provider in _dict ["provider" ]
248- ]
249- if "functions" in _dict :
243+ if "provider" in _dict and isinstance (_dict ["provider" ], dict ):
244+ _dict ["provider" ] = ThinkProvider .from_dict (_dict ["provider" ])
245+ if "functions" in _dict and isinstance (_dict ["functions" ], list ):
250246 _dict ["functions" ] = [
251- Function .from_dict (functions ) for functions in _dict ["functions" ]
247+ Function .from_dict (function ) for function in _dict ["functions" ]
252248 ]
249+ if "endpoint" in _dict and isinstance (_dict ["endpoint" ], dict ):
250+ _dict ["endpoint" ] = Endpoint .from_dict (_dict ["endpoint" ])
253251 return _dict [key ]
254252
255253
@@ -263,10 +261,8 @@ class Listen(BaseResponse):
263261
264262 def __getitem__ (self , key ):
265263 _dict = self .to_dict ()
266- if "provider" in _dict :
267- _dict ["provider" ] = [
268- ListenProvider .from_dict (provider ) for provider in _dict ["provider" ]
269- ]
264+ if "provider" in _dict and isinstance (_dict ["provider" ], dict ):
265+ _dict ["provider" ] = ListenProvider .from_dict (_dict ["provider" ])
270266 return _dict [key ]
271267
272268
@@ -283,14 +279,10 @@ class Speak(BaseResponse):
283279
284280 def __getitem__ (self , key ):
285281 _dict = self .to_dict ()
286- if "provider" in _dict :
287- _dict ["provider" ] = [
288- SpeakProvider .from_dict (provider ) for provider in _dict ["provider" ]
289- ]
290- if "endpoint" in _dict :
291- _dict ["endpoint" ] = [
292- Endpoint .from_dict (endpoint ) for endpoint in _dict ["endpoint" ]
293- ]
282+ if "provider" in _dict and isinstance (_dict ["provider" ], dict ):
283+ _dict ["provider" ] = SpeakProvider .from_dict (_dict ["provider" ])
284+ if "endpoint" in _dict and isinstance (_dict ["endpoint" ], dict ):
285+ _dict ["endpoint" ] = Endpoint .from_dict (_dict ["endpoint" ])
294286 return _dict [key ]
295287
296288
@@ -309,12 +301,12 @@ class Agent(BaseResponse):
309301
310302 def __getitem__ (self , key ):
311303 _dict = self .to_dict ()
312- if "listen" in _dict :
313- _dict ["listen" ] = [ Listen .from_dict (listen ) for listen in _dict ["listen" ]]
314- if "think" in _dict :
315- _dict ["think" ] = [ Think .from_dict (think ) for think in _dict ["think" ]]
316- if "speak" in _dict :
317- _dict ["speak" ] = [ Speak .from_dict (speak ) for speak in _dict ["speak" ]]
304+ if "listen" in _dict and isinstance ( _dict [ "listen" ], dict ) :
305+ _dict ["listen" ] = Listen .from_dict (_dict ["listen" ])
306+ if "think" in _dict and isinstance ( _dict [ "think" ], dict ) :
307+ _dict ["think" ] = Think .from_dict (_dict ["think" ])
308+ if "speak" in _dict and isinstance ( _dict [ "speak" ], dict ) :
309+ _dict ["speak" ] = Speak .from_dict (_dict ["speak" ])
318310 return _dict [key ]
319311
320312
@@ -353,10 +345,10 @@ class Audio(BaseResponse):
353345
354346 def __getitem__ (self , key ):
355347 _dict = self .to_dict ()
356- if "input" in _dict :
357- _dict ["input" ] = [ Input .from_dict (input ) for input in _dict ["input" ]]
358- if "output" in _dict :
359- _dict ["output" ] = [ Output .from_dict (output ) for output in _dict ["output" ]]
348+ if "input" in _dict and isinstance ( _dict [ "input" ], dict ) :
349+ _dict ["input" ] = Input .from_dict (_dict ["input" ])
350+ if "output" in _dict and isinstance ( _dict [ "output" ], dict ) :
351+ _dict ["output" ] = Output .from_dict (_dict ["output" ])
360352 return _dict [key ]
361353
362354
@@ -382,10 +374,10 @@ class SettingsOptions(BaseResponse):
382374
383375 def __getitem__ (self , key ):
384376 _dict = self .to_dict ()
385- if "audio" in _dict :
386- _dict ["audio" ] = [ Audio .from_dict (audio ) for audio in _dict ["audio" ]]
387- if "agent" in _dict :
388- _dict ["agent" ] = [ Agent .from_dict (agent ) for agent in _dict ["agent" ]]
377+ if "audio" in _dict and isinstance ( _dict [ "audio" ], dict ) :
378+ _dict ["audio" ] = Audio .from_dict (_dict ["audio" ])
379+ if "agent" in _dict and isinstance ( _dict [ "agent" ], dict ) :
380+ _dict ["agent" ] = Agent .from_dict (_dict ["agent" ])
389381 return _dict [key ]
390382
391383 def check (self ):
0 commit comments