Avo-k commited on
Commit
c2eef62
β€’
2 Parent(s): a4f403b 80573b8

Merge branch 'main' of https://huggingface.co/spaces/Ekimetrics/climate-question-answering

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -100,11 +100,12 @@ def chat(
100
  sources = "\n\n".join(
101
  [f"query used for retrieval:\n{reformulated_query}"]
102
  + [
103
- f"doc {i}: {d.meta['file_name']} page {d.meta['page_number']}\n{d.content}"
104
  for i, d in enumerate(docs, 1)
105
  ]
106
  )
107
 
 
108
  messages.append({"role": "system", "content": f"{os.environ['sources']}\n\n{sources}"})
109
 
110
  response = openai.Completion.create(
 
100
  sources = "\n\n".join(
101
  [f"query used for retrieval:\n{reformulated_query}"]
102
  + [
103
+ f"πŸ“ƒ doc {i}: {d.meta['file_name']} page {d.meta['page_number']}\n{d.content}"
104
  for i, d in enumerate(docs, 1)
105
  ]
106
  )
107
 
108
+ if sources:
109
  messages.append({"role": "system", "content": f"{os.environ['sources']}\n\n{sources}"})
110
 
111
  response = openai.Completion.create(