chukbert commited on
Commit
1f1886f
·
verified ·
1 Parent(s): 082020b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -27,7 +27,7 @@ def load_embeddings_and_faiss():
27
 
28
  return faiss_index, question_embeddings
29
 
30
- def retrieve_answer(question, faiss_index, embedding_model, answers, threshold=0.2, log_output):
31
  question_embedding = embedding_model.embed_query(question)
32
  distances, indices = faiss_index.search(np.array([question_embedding]), k=1)
33
 
@@ -59,7 +59,7 @@ def chatbot(user_input):
59
  start_time = time.time() # Start timer
60
 
61
  log_output.write("Retrieving answer from FAISS...\n")
62
- response_text = retrieve_answer(user_input, faiss_index, embedding_model, answers, threshold=0.3, log_output)
63
 
64
  if response_text == "No good match found in dataset. Using GPT-4o-mini to generate an answer.":
65
  log_output.write("No good match found in dataset. Using GPT-4o-mini to generate an answer.\n")
 
27
 
28
  return faiss_index, question_embeddings
29
 
30
+ def retrieve_answer(question, faiss_index, embedding_model, answers, log_output, threshold=0.2):
31
  question_embedding = embedding_model.embed_query(question)
32
  distances, indices = faiss_index.search(np.array([question_embedding]), k=1)
33
 
 
59
  start_time = time.time() # Start timer
60
 
61
  log_output.write("Retrieving answer from FAISS...\n")
62
+ response_text = retrieve_answer(user_input, faiss_index, embedding_model, answers, log_output, threshold=0.3)
63
 
64
  if response_text == "No good match found in dataset. Using GPT-4o-mini to generate an answer.":
65
  log_output.write("No good match found in dataset. Using GPT-4o-mini to generate an answer.\n")