Skip to content

Commit 0a1f681

Browse files
committed
fix providers output
1 parent 245c858 commit 0a1f681

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

agixtsdk/__init__.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="agixtsdk",
11-
version="0.0.79",
11+
version="0.0.80",
1212
description="The AGiXT SDK for Python.",
1313
long_description=long_description,
1414
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)