Update app.py
Browse files
app.py
CHANGED
|
@@ -44,8 +44,8 @@ def respond(
|
|
| 44 |
documents = retriever.invoke(message)
|
| 45 |
|
| 46 |
spacer = " \n"
|
| 47 |
-
|
| 48 |
context = ""
|
|
|
|
| 49 |
|
| 50 |
for doc in documents:
|
| 51 |
case_text = df[df["case_url"] == doc.metadata["case_url"]].case_text.values[0]
|
|
@@ -58,11 +58,12 @@ def respond(
|
|
| 58 |
break
|
| 59 |
|
| 60 |
message = f"""
|
| 61 |
-
|
|
|
|
|
|
|
| 62 |
{context}
|
| 63 |
-
Task:
|
| 64 |
-
Instructions: Always answer the user using the language used in his question
|
| 65 |
-
Question: {message}
|
| 66 |
"""
|
| 67 |
|
| 68 |
print(message)
|
|
|
|
| 44 |
documents = retriever.invoke(message)
|
| 45 |
|
| 46 |
spacer = " \n"
|
|
|
|
| 47 |
context = ""
|
| 48 |
+
print(len(documents))
|
| 49 |
|
| 50 |
for doc in documents:
|
| 51 |
case_text = df[df["case_url"] == doc.metadata["case_url"]].case_text.values[0]
|
|
|
|
| 58 |
break
|
| 59 |
|
| 60 |
message = f"""
|
| 61 |
+
A user is asking you the following question: {message}
|
| 62 |
+
Please answer the user in the same language that he used in his question using the following context.
|
| 63 |
+
Context: The following case extracts have been found to fit the question from various Federal Supreme Court of Switzerland and European Court of Human Rights cases:
|
| 64 |
{context}
|
| 65 |
+
Task: Start by summarizing these case in the user's question's language and reference the sources, including the urls and dates.
|
| 66 |
+
Instructions: Always answer the user using the language used in his question: {message}
|
|
|
|
| 67 |
"""
|
| 68 |
|
| 69 |
print(message)
|