clementsan commited on
Commit
04361a6
1 Parent(s): 138ca2e

Extract helpful answer only

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -195,6 +195,8 @@ def conversation(qa_chain, message, history):
195
  # Generate response using QA chain
196
  response = qa_chain({"question": message, "chat_history": formatted_chat_history})
197
  response_answer = response["answer"]
 
 
198
  response_sources = response["source_documents"]
199
  response_source1 = response_sources[0].page_content.strip()
200
  response_source2 = response_sources[1].page_content.strip()
 
195
  # Generate response using QA chain
196
  response = qa_chain({"question": message, "chat_history": formatted_chat_history})
197
  response_answer = response["answer"]
198
+ if response_answer.find("Helpful Answer:") != -1:
199
+ response_answer = response_answer.split("Helpful Answer:")[-1]
200
  response_sources = response["source_documents"]
201
  response_source1 = response_sources[0].page_content.strip()
202
  response_source2 = response_sources[1].page_content.strip()