Update app.py
Browse files
app.py
CHANGED
@@ -345,10 +345,27 @@ def qa_prompt():
|
|
345 |
)
|
346 |
|
347 |
def on_change_documents_only():
|
348 |
-
st.session_state.
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
|
353 |
|
354 |
if __name__ == '__main__':
|
|
|
345 |
)
|
346 |
|
347 |
def on_change_documents_only():
|
348 |
+
if st.session_state.documents_only:
|
349 |
+
st.session_state.toggle_docs = {
|
350 |
+
'qa_prompt': """You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, reply with 'no_answer'. Use three sentences maximum and keep the answer concise.
|
351 |
+
|
352 |
+
Question: {query}
|
353 |
+
|
354 |
+
Context: {context}
|
355 |
+
|
356 |
+
Answer:""",
|
357 |
+
'tooltip': 'The AI answer your questions only considering the documents provided'
|
358 |
+
}
|
359 |
+
else:
|
360 |
+
st.session_state.toggle_docs = {
|
361 |
+
'qa_prompt': """If the context is not relevant, please answer the question by using your own knowledge about the topic.
|
362 |
+
If you decide to provide information using your own knowledge or general knowledge, write 'knowledge_topic' at the top of your answer.
|
363 |
+
|
364 |
+
{context}
|
365 |
+
|
366 |
+
Question: {query}""",
|
367 |
+
'tooltip': 'The AI answer your questions considering the documents provided, and if it doesn't found the answer in them, try to find in its own internal knowledge'
|
368 |
+
}
|
369 |
|
370 |
|
371 |
if __name__ == '__main__':
|