Update app.py
Browse files
app.py
CHANGED
@@ -34,8 +34,6 @@ Don't make up an answer or give irrelevant information not requested by the user
|
|
34 |
Otherwise, if relevant cases were found, start by summarizing these cases in the user's question's language and reference the sources, including the source, urls and dates.
|
35 |
"""
|
36 |
|
37 |
-
retriever = vector_db.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": score})
|
38 |
-
|
39 |
def respond(
|
40 |
message,
|
41 |
history: list[tuple[str, str]],
|
@@ -45,6 +43,7 @@ def respond(
|
|
45 |
top_p,
|
46 |
score,
|
47 |
):
|
|
|
48 |
documents = retriever.invoke(message)
|
49 |
|
50 |
spacer = " \n"
|
@@ -64,12 +63,13 @@ def respond(
|
|
64 |
system_message += f"""
|
65 |
The following case extracts have been found in either Swiss Federal Court or European Court of Human Rights cases and could fit the question:
|
66 |
{context}
|
67 |
-
|
68 |
"""
|
69 |
|
70 |
messages = [{"role": "system", "content": system_message}]
|
71 |
|
72 |
print(system_message)
|
|
|
73 |
|
74 |
# message = f"""
|
75 |
#The user is asking you the following question: {message}
|
|
|
34 |
Otherwise, if relevant cases were found, start by summarizing these cases in the user's question's language and reference the sources, including the source, urls and dates.
|
35 |
"""
|
36 |
|
|
|
|
|
37 |
def respond(
|
38 |
message,
|
39 |
history: list[tuple[str, str]],
|
|
|
43 |
top_p,
|
44 |
score,
|
45 |
):
|
46 |
+
retriever = vector_db.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": score})
|
47 |
documents = retriever.invoke(message)
|
48 |
|
49 |
spacer = " \n"
|
|
|
63 |
system_message += f"""
|
64 |
The following case extracts have been found in either Swiss Federal Court or European Court of Human Rights cases and could fit the question:
|
65 |
{context}
|
66 |
+
Instructions: Always answer the user using the language used in his question.
|
67 |
"""
|
68 |
|
69 |
messages = [{"role": "system", "content": system_message}]
|
70 |
|
71 |
print(system_message)
|
72 |
+
print(message)
|
73 |
|
74 |
# message = f"""
|
75 |
#The user is asking you the following question: {message}
|