Commit
·
ee90460
1
Parent(s):
f3f3f8f
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,9 @@ openai.api_key = os.environ['key']
|
|
6 |
|
7 |
model_name = "ft:gpt-3.5-turbo-0613:metric-space-ug:rechtsberatung2:7zmeC6ps"
|
8 |
prompt0 = "Liegt ein rechtlich relevanter Sachverhalt mit einer passenden Frage vor?"
|
9 |
-
prompt1 = "Du stellst Fragen, um fehlende Informationen für eine anwaltliche Erstberatung zu klären. Stelle bis zu
|
10 |
prompt2 = "Schreibe den Sachverhalt auf Basis der folgenden Informationen zusammen."
|
11 |
-
prompt3 = "Schreibe eine anwaltliche Erstberatung auf Basis des geschilderten Sachverhalts. Vermeide Konjuktive, formuliere in gutem Deutsch und
|
12 |
|
13 |
def respond_prompt0(Selbstauskunft, Kernfrage, chat):
|
14 |
# preprocess data
|
@@ -43,7 +43,7 @@ def respond_prompt0(Selbstauskunft, Kernfrage, chat):
|
|
43 |
return out, gr.update(value=chat, visible=True), gr.update(value="", visible=True)
|
44 |
|
45 |
else:
|
46 |
-
return out + "\nLeider kann ich dir nicht weiterhelfen
|
47 |
|
48 |
|
49 |
def respond_prompt1(Selbstauskunft, Kernfrage, chat, text):
|
@@ -69,9 +69,9 @@ def respond_prompt1(Selbstauskunft, Kernfrage, chat, text):
|
|
69 |
|
70 |
if ("<ENDOFQA>" in output_prompt1) or len(chat) > 10:
|
71 |
sachverhalt = respond_prompt2(Selbstauskunft, Kernfrage, chat).replace("Bürger", "Mandant")
|
72 |
-
chat.append(("Danke für deine Antworten. Hier findest du eine aufarbeitete Zusamenfassung des Sachverhalts. Bitte prüfe
|
73 |
|
74 |
-
return chat, gr.update(value="", visible=False), gr.update(value=sachverhalt, visible=True), gr.update(value="Weiter", visible=True)
|
75 |
|
76 |
chat.append((output_prompt1, ""))
|
77 |
|
@@ -113,7 +113,7 @@ def respond_prompt3(Selbstauskunft, Kernfrage, chat, Sachverhalt):
|
|
113 |
{ "role": "user", "content": content + "\nSachverhalt: " + Sachverhalt}])
|
114 |
|
115 |
|
116 |
-
output_prompt3 =completion.choices[0].message.content
|
117 |
########
|
118 |
|
119 |
return gr.update(value=output_prompt3, visible=True), gr.update(visible=False)
|
|
|
6 |
|
7 |
model_name = "ft:gpt-3.5-turbo-0613:metric-space-ug:rechtsberatung2:7zmeC6ps"
|
8 |
prompt0 = "Liegt ein rechtlich relevanter Sachverhalt mit einer passenden Frage vor?"
|
9 |
+
prompt1 = "Du stellst Fragen, um fehlende Informationen für eine anwaltliche Erstberatung zu klären. Stelle bis zu 10 Fragen für die Klärung der Sachlage und antworte mit „Danke für die Antworten.“, sobald die Sachlage klar ist. Vermeide Fragen zu stellen, die schon benantwortet sind"
|
10 |
prompt2 = "Schreibe den Sachverhalt auf Basis der folgenden Informationen zusammen."
|
11 |
+
prompt3 = "Schreibe eine anwaltliche Erstberatung auf Basis des geschilderten Sachverhalts. Vermeide Konjuktive, formuliere in gutem Deutsch und kurzen Sätzen."
|
12 |
|
13 |
def respond_prompt0(Selbstauskunft, Kernfrage, chat):
|
14 |
# preprocess data
|
|
|
43 |
return out, gr.update(value=chat, visible=True), gr.update(value="", visible=True)
|
44 |
|
45 |
else:
|
46 |
+
return out + "\nLeider kann ich dir nicht weiterhelfen. Der Grund dafür ist: ", chat, ""
|
47 |
|
48 |
|
49 |
def respond_prompt1(Selbstauskunft, Kernfrage, chat, text):
|
|
|
69 |
|
70 |
if ("<ENDOFQA>" in output_prompt1) or len(chat) > 10:
|
71 |
sachverhalt = respond_prompt2(Selbstauskunft, Kernfrage, chat).replace("Bürger", "Mandant")
|
72 |
+
chat.append(("Danke für deine Antworten. Hier findest du eine aufarbeitete Zusamenfassung des Sachverhalts. Bitte prüfe dieee und ergänze ggf. noch etwas, bevor ich zu meiner Einschätzung komme.", ""))
|
73 |
|
74 |
+
return chat, gr.update(value="", visible=False), gr.update(value=sachverhalt, visible=True), gr.update(value="Weiter zur juristischen Einschätzung", visible=True)
|
75 |
|
76 |
chat.append((output_prompt1, ""))
|
77 |
|
|
|
113 |
{ "role": "user", "content": content + "\nSachverhalt: " + Sachverhalt}])
|
114 |
|
115 |
|
116 |
+
output_prompt3 =completion.choices[0].message.content + "\n\n(Dies ist eine maschinell erstellte Einschätzung einer experimentellen KI-Software. Interpretieren Sie das Ergebnis mit Vorsicht.)"
|
117 |
########
|
118 |
|
119 |
return gr.update(value=output_prompt3, visible=True), gr.update(visible=False)
|