sabazo commited on
Commit
c255715
1 Parent(s): 55450d7

added sources list

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -38,10 +38,13 @@ def add_text(history, text):
38
  def bot(history):
39
  response = infer(history[-1][0])
40
  history[-1][1] = response['result']
41
- return history
 
 
 
 
42
 
43
- def infer(question):
44
-
45
  query = question
46
  result = qa({"query": query})
47
  return result
 
38
  def bot(history):
39
  response = infer(history[-1][0])
40
  history[-1][1] = response['result']
41
+ sources = [doc.metadata.get("source") for doc in response['source_documents']]
42
+ src_list = '\n'.join(sources)
43
+ print_this = response['result']+"\n\n\n Sources: \n\n\n"+src_list
44
+ # return history
45
+ return print_this
46
 
47
+ def infer(question):
 
48
  query = question
49
  result = qa({"query": query})
50
  return result