Spaces:
Runtime error
Runtime error
kw test
Browse files- src/chatbot.py +5 -1
src/chatbot.py
CHANGED
@@ -70,7 +70,8 @@ def keyword_search(query, db=db, embeddings=embeddings):
|
|
70 |
# Format vector store query results into dataframe
|
71 |
#print(results[0][0].metadata.keys())
|
72 |
|
73 |
-
df_res = pd.DataFrame(columns=['Speech Content','Date','Relevance']) # Add Date/Party/Politician
|
|
|
74 |
for doc in results:
|
75 |
speech_content = doc[0].page_content
|
76 |
speech_date = doc[0].metadata["date"]
|
@@ -80,6 +81,9 @@ def keyword_search(query, db=db, embeddings=embeddings):
|
|
80 |
'Date': [speech_date],
|
81 |
'Party': [party],
|
82 |
'Relevance': [score]})], ignore_index=True)
|
|
|
|
|
|
|
83 |
|
84 |
df_res.sort_values('Relevance', inplace=True, ascending=False)
|
85 |
return df_res
|
|
|
70 |
# Format vector store query results into dataframe
|
71 |
#print(results[0][0].metadata.keys())
|
72 |
|
73 |
+
df_res = pd.DataFrame(columns=['Speech Content','Date', 'Party', 'Relevance']) # Add Date/Party/Politician
|
74 |
+
i = 0
|
75 |
for doc in results:
|
76 |
speech_content = doc[0].page_content
|
77 |
speech_date = doc[0].metadata["date"]
|
|
|
81 |
'Date': [speech_date],
|
82 |
'Party': [party],
|
83 |
'Relevance': [score]})], ignore_index=True)
|
84 |
+
i = i + 1
|
85 |
+
if i > 2:
|
86 |
+
break
|
87 |
|
88 |
df_res.sort_values('Relevance', inplace=True, ascending=False)
|
89 |
return df_res
|