Update app.py
Browse files
app.py
CHANGED
@@ -57,14 +57,15 @@ def response(prompt, history, selected_option, temperature=0.9, max_new_tokens=5
|
|
57 |
query_texts=[search_prompt],
|
58 |
n_results=60
|
59 |
)
|
60 |
-
|
61 |
dists = ["<br><small>(relevance: " + str(round((1 - d) * 100) / 100) + ";" for d in results['distances'][0]]
|
62 |
results = results['documents'][0]
|
63 |
combination = zip(results, dists)
|
64 |
combination = [' '.join(triplets) for triplets in combination]
|
|
|
65 |
if len(results) > 1:
|
66 |
addon = "Bitte berücksichtige bei deiner Antwort ausschießlich folgende Auszüge aus unserer Wahlhilfe Datenbank, sofern sie für die Antwort erforderlich sind. Beantworte die Frage knapp und präzise. Ignoriere unpassende Datenbank-Auszüge OHNE sie zu kommentieren, zu erwähnen oder aufzulisten:\n" + "\n".join(results)
|
67 |
-
system = "Du heißt Avah und bist ein deutschsprachiges KI-basiertes Wahlhilfe Beratungssystem zum Wahl-O-Maten für die Bundestagswahl 2021. Du nimmst selber keine eigene politische Postion ein!" + addon + "\n\nUser-Anliegen:"
|
68 |
|
69 |
formatted_prompt = format_prompt(system + "\n" + selected_option + "\n" + prompt, history)
|
70 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
57 |
query_texts=[search_prompt],
|
58 |
n_results=60
|
59 |
)
|
60 |
+
|
61 |
dists = ["<br><small>(relevance: " + str(round((1 - d) * 100) / 100) + ";" for d in results['distances'][0]]
|
62 |
results = results['documents'][0]
|
63 |
combination = zip(results, dists)
|
64 |
combination = [' '.join(triplets) for triplets in combination]
|
65 |
+
print(results)
|
66 |
if len(results) > 1:
|
67 |
addon = "Bitte berücksichtige bei deiner Antwort ausschießlich folgende Auszüge aus unserer Wahlhilfe Datenbank, sofern sie für die Antwort erforderlich sind. Beantworte die Frage knapp und präzise. Ignoriere unpassende Datenbank-Auszüge OHNE sie zu kommentieren, zu erwähnen oder aufzulisten:\n" + "\n".join(results)
|
68 |
+
system = "Du heißt Avah und bist ein deutschsprachiges KI-basiertes Wahlhilfe Beratungssystem zum Wahl-O-Maten für die Bundestagswahl 2021, an welchem insgesamt 38 Parteien teilgenommen haben. Du nimmst selber keine eigene politische Postion ein!" + addon + "\n\nUser-Anliegen:"
|
69 |
|
70 |
formatted_prompt = format_prompt(system + "\n" + selected_option + "\n" + prompt, history)
|
71 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|