LeedsLibraries commited on
Commit
be4b338
·
verified ·
1 Parent(s): 6f72d10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1255,9 +1255,13 @@ if retriever:
1255
 
1256
  with st.chat_message("assistant"):
1257
  try:
1258
- retrieved_docs = retriever.invoke(prompt)
1259
- answer, sources, should_reset, new_follow_up = process_query(prompt, retrieved_docs)
 
 
 
1260
 
 
1261
  if should_reset:
1262
  st.session_state.conversation_id += 1
1263
  st.session_state.messages = []
 
1255
 
1256
  with st.chat_message("assistant"):
1257
  try:
1258
+ # Only retrieve documents if NOT conversational
1259
+ if is_conversational_input(prompt):
1260
+ retrieved_docs = None
1261
+ else:
1262
+ retrieved_docs = retriever.invoke(prompt)
1263
 
1264
+ answer, sources, should_reset, new_follow_up = process_query(prompt, retrieved_docs)
1265
  if should_reset:
1266
  st.session_state.conversation_id += 1
1267
  st.session_state.messages = []