Update app.py
Browse filesadded source nodes
app.py
CHANGED
@@ -116,7 +116,7 @@ retriever = DocumentSummaryIndexEmbeddingRetriever(
|
|
116 |
# set up retriever
|
117 |
retriever = VectorIndexRetriever(
|
118 |
index = index,
|
119 |
-
similarity_top_k =
|
120 |
#vector_store_query_mode="mmr",
|
121 |
#vector_store_kwargs={"mmr_threshold": 0.4}
|
122 |
)
|
@@ -198,8 +198,11 @@ with gr.Blocks() as demo:
|
|
198 |
def bot(history):
|
199 |
user_message = history[-1][0]
|
200 |
#bot_message = chat_engine.chat(user_message)
|
|
|
201 |
bot_message = query_engine.query(user_message + "Let's think step by step to get the correct answer. If you cannot provide an answer, say you don't know.")
|
202 |
-
|
|
|
|
|
203 |
final_response = bot_message.response + "\n Source nodes: \n" + source_nodes
|
204 |
history[-1][1] = ""
|
205 |
for character in final_response:
|
|
|
116 |
# set up retriever
|
117 |
retriever = VectorIndexRetriever(
|
118 |
index = index,
|
119 |
+
similarity_top_k = 15,
|
120 |
#vector_store_query_mode="mmr",
|
121 |
#vector_store_kwargs={"mmr_threshold": 0.4}
|
122 |
)
|
|
|
198 |
def bot(history):
|
199 |
user_message = history[-1][0]
|
200 |
#bot_message = chat_engine.chat(user_message)
|
201 |
+
source_nodes = ""
|
202 |
bot_message = query_engine.query(user_message + "Let's think step by step to get the correct answer. If you cannot provide an answer, say you don't know.")
|
203 |
+
source_nodes_list = bot_message.source_nodes
|
204 |
+
for nodes in source_nodes_list:
|
205 |
+
source_nodes = source_nodes + nodes + "\n\n"
|
206 |
final_response = bot_message.response + "\n Source nodes: \n" + source_nodes
|
207 |
history[-1][1] = ""
|
208 |
for character in final_response:
|