Spaces:
Build error
Build error
Commit
·
f9e10ad
1
Parent(s):
8aa52ea
Update weaviate_utils.py
Browse files- weaviate_utils.py +9 -7
weaviate_utils.py
CHANGED
|
@@ -11,17 +11,19 @@ def hybrid_search_weaviate(client, selected_class, query):
|
|
| 11 |
Perform a hybrid search on Weaviate using the provided class and query.
|
| 12 |
Return the results as a list of dictionaries.
|
| 13 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Perform the hybrid search
|
| 15 |
-
results = client.
|
| 16 |
-
className=selected_class,
|
| 17 |
-
query=query,
|
| 18 |
-
filters=None, # No additional filters for now
|
| 19 |
-
limit=100 # Limit to 100 results for now
|
| 20 |
-
)
|
| 21 |
|
| 22 |
return results
|
| 23 |
|
| 24 |
-
|
| 25 |
def convert_to_tapas_format(data):
|
| 26 |
"""
|
| 27 |
Convert the list of dictionaries (from Weaviate) into the format TAPAS expects.
|
|
|
|
| 11 |
Perform a hybrid search on Weaviate using the provided class and query.
|
| 12 |
Return the results as a list of dictionaries.
|
| 13 |
"""
|
| 14 |
+
# Construct the hybrid search query
|
| 15 |
+
search_query = {
|
| 16 |
+
"class": selected_class,
|
| 17 |
+
"properties": [], # Retrieve all properties for now
|
| 18 |
+
"searchString": query,
|
| 19 |
+
"limit": 100 # Limit to 100 results for now
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
# Perform the hybrid search
|
| 23 |
+
results = client.get(search_query)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
return results
|
| 26 |
|
|
|
|
| 27 |
def convert_to_tapas_format(data):
|
| 28 |
"""
|
| 29 |
Convert the list of dictionaries (from Weaviate) into the format TAPAS expects.
|