in aidial_sdk/utils/merge_chunks.py [0:0]
def is_indexed_list(xs: list) -> bool:
if len(xs) == 0:
return False
all_indexed = True
any_indexed = False
for elem in xs:
if isinstance(elem, dict) and "index" in elem:
any_indexed = True
else:
all_indexed = False
if any_indexed and not all_indexed:
raise AssertionError(INCONSISTENT_INDEXED_LIST_ERROR_MESSAGE)
return all_indexed