Update app.py
Browse files
app.py
CHANGED
|
@@ -40,12 +40,21 @@ def respond(
|
|
| 40 |
"""
|
| 41 |
|
| 42 |
spacer = " \n "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
message = f"""
|
| 45 |
The user is asking for information about the following: {message}.
|
| 46 |
-
Answer him in his own language using the information from the following
|
| 47 |
-
{
|
| 48 |
-
Please mention your sources.
|
|
|
|
| 49 |
|
| 50 |
"""
|
| 51 |
|
|
|
|
| 40 |
"""
|
| 41 |
|
| 42 |
spacer = " \n "
|
| 43 |
+
|
| 44 |
+
context = ""
|
| 45 |
+
|
| 46 |
+
for doc in documents:
|
| 47 |
+
context += "Case number: " + doc.metadata["case_nb"] + "\n"
|
| 48 |
+
context += "Case date: " + doc.metadata["case_date"] + "\n"
|
| 49 |
+
context += "Case url: " + doc.metadata["case_url"] + "\n"
|
| 50 |
+
context += "Case chunk: " + doc.page_content + "\n"
|
| 51 |
|
| 52 |
message = f"""
|
| 53 |
The user is asking for information about the following: {message}.
|
| 54 |
+
Answer him in his own language using the information from the following Swiss federal jurisprudence cases:
|
| 55 |
+
{context}
|
| 56 |
+
Please mention your sources in your answer.
|
| 57 |
+
If you don't know just mention the sources.
|
| 58 |
|
| 59 |
"""
|
| 60 |
|