Skip to content

Commit ab14f37

Browse files
committed
Fix #2960 by checking values are list of list
1 parent ded8e1b commit ab14f37

File tree

1 file changed

+6
-2
lines changed
  • autogen/agentchat/contrib/vectordb

1 file changed

+6
-2
lines changed

autogen/agentchat/contrib/vectordb/utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,19 @@ def chroma_results_to_query_results(data_dict: Dict[str, List[List[Any]]], speci
9999
]
100100
"""
101101

102-
keys = [key for key in data_dict if key != special_key]
102+
keys = [
103+
key
104+
for key in data_dict
105+
if key != special_key and data_dict[key] is not None and isinstance(data_dict[key][0], list)
106+
]
103107
result = []
104108

105109
for i in range(len(data_dict[special_key])):
106110
sub_result = []
107111
for j, distance in enumerate(data_dict[special_key][i]):
108112
sub_dict = {}
109113
for key in keys:
110-
if data_dict[key] is not None and len(data_dict[key]) > i:
114+
if len(data_dict[key]) > i:
111115
sub_dict[key[:-1]] = data_dict[key][i][j] # remove 's' in the end from key
112116
sub_result.append((sub_dict, distance))
113117
result.append(sub_result)

0 commit comments

Comments
 (0)