abhivsh commited on
Commit
949bfcf
·
verified ·
1 Parent(s): a16ee2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -62,7 +62,6 @@ def chat_query(question, history):
62
 
63
 
64
  query = f"""As an experienced Electrical Engineer, please provide an elaborate, precise, and pointwise answer politely to the question: {question}.
65
- Also, Please consider the provided chat history: {history[:-1]}
66
  Ensure that your response is detailed, accurate, and addresses each aspect of the question thoroughly.
67
  If the context of the question doesn't align with the chat history, please provide your response in a fresh manner. """
68
 
@@ -75,12 +74,12 @@ def chat_query(question, history):
75
  qa = ConversationalRetrievalChain.from_llm(llm, retriever=retriever, return_source_documents=True)
76
 
77
  # Replace input() with question variable for Gradio
78
- result = qa({"question": query, "chat_history" : history[:-1]})
79
 
80
 
81
  source_docs = result["source_documents"]
82
- file_name = get_file(source_docs)[0]
83
-
84
 
85
  return result["answer"] + "\n\nSource : " + file_name
86
 
 
62
 
63
 
64
  query = f"""As an experienced Electrical Engineer, please provide an elaborate, precise, and pointwise answer politely to the question: {question}.
 
65
  Ensure that your response is detailed, accurate, and addresses each aspect of the question thoroughly.
66
  If the context of the question doesn't align with the chat history, please provide your response in a fresh manner. """
67
 
 
74
  qa = ConversationalRetrievalChain.from_llm(llm, retriever=retriever, return_source_documents=True)
75
 
76
  # Replace input() with question variable for Gradio
77
+ result = qa({"question": query, "chat_history" : history})
78
 
79
 
80
  source_docs = result["source_documents"]
81
+ #file_name = get_file(source_docs)[0]
82
+ file_name = os.path.basename(source_docs[0].metadata['source'])
83
 
84
  return result["answer"] + "\n\nSource : " + file_name
85