Upload app_federal.py
Browse files- app_federal.py +3 -2
app_federal.py
CHANGED
@@ -250,7 +250,7 @@ def rerank_with_chatGPT(query, search_results):
|
|
250 |
Return a python list with the ids of the five highest ranking results, nothing else.
|
251 |
<query>""" + query + "</query>\n\n"
|
252 |
user_prompt = []
|
253 |
-
for i in search_results[:
|
254 |
user_prompt.append(format_metadata_for_reranking(i["metadata_reranking"], i["text"], i["index"]))
|
255 |
user_prompt = "\n".join(user_prompt)
|
256 |
out = text_prompt_call("gpt-4o", system_prompt, user_prompt)
|
@@ -303,7 +303,8 @@ def run_retrieval(query):
|
|
303 |
else:
|
304 |
item["metadata_reranking"] = ""
|
305 |
out_dict.append(item)
|
306 |
-
print (
|
|
|
307 |
out_dict = rerank_with_chatGPT(query, out_dict)[:NUM_RESULTS]
|
308 |
print ("RETURNING OUT DICT")
|
309 |
return out_dict
|
|
|
250 |
Return a python list with the ids of the five highest ranking results, nothing else.
|
251 |
<query>""" + query + "</query>\n\n"
|
252 |
user_prompt = []
|
253 |
+
for i in search_results[:50]:
|
254 |
user_prompt.append(format_metadata_for_reranking(i["metadata_reranking"], i["text"], i["index"]))
|
255 |
user_prompt = "\n".join(user_prompt)
|
256 |
out = text_prompt_call("gpt-4o", system_prompt, user_prompt)
|
|
|
303 |
else:
|
304 |
item["metadata_reranking"] = ""
|
305 |
out_dict.append(item)
|
306 |
+
print ("out_dict_before_reranking")
|
307 |
+
print (out_dict[:50])
|
308 |
out_dict = rerank_with_chatGPT(query, out_dict)[:NUM_RESULTS]
|
309 |
print ("RETURNING OUT DICT")
|
310 |
return out_dict
|