Spaces:
Build error
Build error
Commit
·
475a4a4
1
Parent(s):
69983c5
Update weaviate_utils.py
Browse files- weaviate_utils.py +6 -2
weaviate_utils.py
CHANGED
@@ -27,13 +27,17 @@ def hybrid_search_weaviate(client, selected_class, query):
|
|
27 |
return results
|
28 |
|
29 |
|
30 |
-
|
31 |
def convert_to_tapas_format(data):
|
32 |
"""
|
33 |
Convert the list of dictionaries (from Weaviate) into the format TAPAS expects.
|
34 |
Return the table as a list of lists.
|
35 |
"""
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
table = [df.columns.tolist()] + df.values.tolist()
|
38 |
return table
|
39 |
|
|
|
27 |
return results
|
28 |
|
29 |
|
|
|
30 |
def convert_to_tapas_format(data):
|
31 |
"""
|
32 |
Convert the list of dictionaries (from Weaviate) into the format TAPAS expects.
|
33 |
Return the table as a list of lists.
|
34 |
"""
|
35 |
+
# Extract the data objects from the results
|
36 |
+
data_objects = data.get('data', {}).get('Get', {}).get('Things', [])
|
37 |
+
|
38 |
+
# Convert the data objects into a DataFrame
|
39 |
+
df = pd.DataFrame([obj['thing'] for obj in data_objects])
|
40 |
+
|
41 |
table = [df.columns.tolist()] + df.values.tolist()
|
42 |
return table
|
43 |
|