Mehrdad Esmaeili commited on
Commit
f415ccc
1 Parent(s): acf1331

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -69,7 +69,8 @@ def predict(message, history):
69
  # print([(item[-2].metadata,item[-1]) for item in r1],\
70
  # '\n\n',result['result'],f'|| {result["source_documents"][0].metadata}','\n*****\n')
71
  if result['result'] not in ["I don't know","I don't know."]:
72
- return result['result']+f'\n---\nAmazon Kindle ebook description is:\n {result["source_documents"][0].page_content}'+\
 
73
  f'\nfrom this file: {result["source_documents"][0].metadata}'
74
  else:
75
  return result['result']
 
69
  # print([(item[-2].metadata,item[-1]) for item in r1],\
70
  # '\n\n',result['result'],f'|| {result["source_documents"][0].metadata}','\n*****\n')
71
  if result['result'] not in ["I don't know","I don't know."]:
72
+ return result['result']+f'\n---\nIgnore the description below if the chatbot reponded with low confidence \
73
+ or if the response is not about the book shown below\nAmazon Kindle ebook description is:\n {result["source_documents"][0].page_content}'+\
74
  f'\nfrom this file: {result["source_documents"][0].metadata}'
75
  else:
76
  return result['result']