added stepback-Prompting
Browse files
app.py
CHANGED
|
@@ -357,11 +357,11 @@ class BSIChatbot:
|
|
| 357 |
# )
|
| 358 |
|
| 359 |
# Alles außer letzte Useranfrage, Normaler Query
|
| 360 |
-
query, context = retrieval(query, True)
|
| 361 |
if stepBackPrompt == True:
|
| 362 |
-
stepBackQuery = stepBackPrompt(query)
|
| 363 |
print("DBG stepBackQuery:" + stepBackQuery)
|
| 364 |
-
stepBackQuery, stepBackContext = retrieval(stepBackQuery, True)
|
| 365 |
print("DBG stepBackContext:" + stepBackContext)
|
| 366 |
sysPrompt = """
|
| 367 |
You are an helpful Chatbot for the BSI IT-Grundschutz. Using the information contained in the context,
|
|
@@ -370,7 +370,7 @@ class BSIChatbot:
|
|
| 370 |
Provide the source document when relevant for the understanding.
|
| 371 |
If the answer cannot be deduced from the context, do not give an answer.
|
| 372 |
"""
|
| 373 |
-
stepBackAnswer = queryRemoteLLM(sysPrompt, stepBackQuery, True)
|
| 374 |
print("DBG stepBackAnswer:" + stepBackAnswer)
|
| 375 |
context += "Übergreifende Frage:" + stepBackQuery + "Übergreifender Context:" + stepBackAnswer
|
| 376 |
|
|
|
|
| 357 |
# )
|
| 358 |
|
| 359 |
# Alles außer letzte Useranfrage, Normaler Query
|
| 360 |
+
query, context = self.retrieval(query, True)
|
| 361 |
if stepBackPrompt == True:
|
| 362 |
+
stepBackQuery = self.stepBackPrompt(query)
|
| 363 |
print("DBG stepBackQuery:" + stepBackQuery)
|
| 364 |
+
stepBackQuery, stepBackContext = self.retrieval(stepBackQuery, True)
|
| 365 |
print("DBG stepBackContext:" + stepBackContext)
|
| 366 |
sysPrompt = """
|
| 367 |
You are an helpful Chatbot for the BSI IT-Grundschutz. Using the information contained in the context,
|
|
|
|
| 370 |
Provide the source document when relevant for the understanding.
|
| 371 |
If the answer cannot be deduced from the context, do not give an answer.
|
| 372 |
"""
|
| 373 |
+
stepBackAnswer = self.queryRemoteLLM(sysPrompt, stepBackQuery, True)
|
| 374 |
print("DBG stepBackAnswer:" + stepBackAnswer)
|
| 375 |
context += "Übergreifende Frage:" + stepBackQuery + "Übergreifender Context:" + stepBackAnswer
|
| 376 |
|