Merge branch 'main' of https://huggingface.co/spaces/Ekimetrics/climate-question-answering
Browse files
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(
|