Shreyas094 commited on
Commit
be37cab
·
verified ·
1 Parent(s): a232636

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -220,10 +220,14 @@ def retry_last_response(history, use_web_search, model, temperature, num_calls):
220
 
221
  return chatbot_interface(last_user_msg, history, use_web_search, model, temperature, num_calls)
222
 
223
- def respond(message, history, model, temperature, num_calls, use_web_search, selected_docs):
224
  logging.info(f"User Query: {message}")
225
  logging.info(f"Model Used: {model}")
226
  logging.info(f"Search Type: {'Web Search' if use_web_search else 'PDF Search'}")
 
 
 
 
227
  logging.info(f"Selected Documents: {selected_docs}")
228
 
229
  try:
@@ -270,7 +274,7 @@ def respond(message, history, model, temperature, num_calls, use_web_search, sel
270
  if "microsoft/Phi-3-mini-4k-instruct" in model:
271
  logging.info("Falling back to Mistral model due to Phi-3 error")
272
  fallback_model = "mistralai/Mistral-7B-Instruct-v0.3"
273
- yield from respond(message, history, fallback_model, temperature, num_calls, use_web_search, selected_docs)
274
  else:
275
  yield f"An error occurred with the {model} model: {str(e)}. Please try again or select a different model."
276
 
 
220
 
221
  return chatbot_interface(last_user_msg, history, use_web_search, model, temperature, num_calls)
222
 
223
+ def respond(message, history, model, temperature, num_calls, use_web_search):
224
  logging.info(f"User Query: {message}")
225
  logging.info(f"Model Used: {model}")
226
  logging.info(f"Search Type: {'Web Search' if use_web_search else 'PDF Search'}")
227
+
228
+ # Get the selected documents from the document_selector
229
+ selected_docs = document_selector.value
230
+
231
  logging.info(f"Selected Documents: {selected_docs}")
232
 
233
  try:
 
274
  if "microsoft/Phi-3-mini-4k-instruct" in model:
275
  logging.info("Falling back to Mistral model due to Phi-3 error")
276
  fallback_model = "mistralai/Mistral-7B-Instruct-v0.3"
277
+ yield from respond(message, history, fallback_model, temperature, num_calls, use_web_search)
278
  else:
279
  yield f"An error occurred with the {model} model: {str(e)}. Please try again or select a different model."
280