@@ -156,7 +156,11 @@ def get_providers(self) -> List[Dict[str, Any]]:
156156 )
157157 if self .verbose :
158158 parse_response (response )
159- return response .json ()["providers" ]
159+ data = response .json ()
160+ # Handle both list (v1) and dict (legacy) responses
161+ if isinstance (data , list ):
162+ return data
163+ return data .get ("providers" , data )
160164 except Exception as e :
161165 return self .handle_error (e )
162166
@@ -412,7 +416,11 @@ def get_conversations(self, agent_id: str = "") -> List[Dict[str, Any]]:
412416 )
413417 if self .verbose :
414418 parse_response (response )
415- return response .json ()["conversations" ]
419+ data = response .json ()
420+ # Handle both list (v1) and dict (legacy) responses
421+ if isinstance (data , list ):
422+ return data
423+ return data .get ("conversations" , data )
416424 except Exception as e :
417425 return self .handle_error (e )
418426
@@ -426,7 +434,11 @@ def get_conversations_with_ids(self) -> List[Dict[str, Any]]:
426434 )
427435 if self .verbose :
428436 parse_response (response )
429- return response .json ()["conversations_with_ids" ]
437+ data = response .json ()
438+ # Handle both list (v1) and dict (legacy) responses
439+ if isinstance (data , list ):
440+ return data
441+ return data .get ("conversations_with_ids" , data .get ("conversations" , data ))
430442 except Exception as e :
431443 return self .handle_error (e )
432444
@@ -1150,7 +1162,11 @@ def get_extensions(self):
11501162 )
11511163 if self .verbose :
11521164 parse_response (response )
1153- return response .json ()["extensions" ]
1165+ data = response .json ()
1166+ # Handle both list (v1) and dict (legacy) responses
1167+ if isinstance (data , list ):
1168+ return data
1169+ return data .get ("extensions" , data )
11541170 except Exception as e :
11551171 return self .handle_error (e )
11561172
0 commit comments