From 92ec42b0dac3160f4e1be9df2e6627f3c3c6acc1 Mon Sep 17 00:00:00 2001 From: Alexis VIALARET Date: Tue, 16 Jan 2024 17:20:18 +0100 Subject: [PATCH] fix: removed linebreaks in prompts --- backend/rag_components/prompts.py | 36 ++++++++++--------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/backend/rag_components/prompts.py b/backend/rag_components/prompts.py index bbb7775..5edce19 100644 --- a/backend/rag_components/prompts.py +++ b/backend/rag_components/prompts.py @@ -1,37 +1,23 @@ condense_history = """ -Given the conversation history and the following question, can you rephrase the user's question in its original \ - language so that it is self-sufficient. Make sure to avoid the use of unclear pronouns. +Given the conversation history and the following question, can you rephrase the user's question in its original language so that it is self-sufficient. You are presented with a conversation that may contain some spelling mistakes and grammatical errors, but your goal is to understand the underlying question. Make sure to avoid the use of unclear pronouns. -Chat history : -{chat_history} -Question : {question} +Chat history: {chat_history} -Rephrased question : -""" +If the question is already self-sufficient, return the original question. If it seem the user is authorizing the chatbot to answer without specific context, make sure to reflect that in the rephrased question. + +Question: {question} -rag_system_prompt = """ -As a chatbot assistant, your mission is to respond to user inquiries in a precise and concise manner based on \ - the documents provided as input. -It is essential to respond in the same language in which the question was asked. Responses must be written in \ - a professional style and must demonstrate great attention to detail. +Rephrased question: """ respond_to_question = """ -As a chatbot assistant, your mission is to respond to user inquiries in a precise and concise manner based on \ - the documents provided as input. -It is essential to respond in the same language in which the question was asked. Responses must be written in \ - a professional style and must demonstrate great attention to detail. - - -Respond to the question taking into account the following context. - -{context} +As a chatbot assistant, your mission is to respond to user inquiries in a precise and concise manner based on the documents provided as input. It is essential to respond in the same language in which the question was asked. Responses must be written in a professional style and must demonstrate great attention to detail. You must sift through various sources of information, disregarding any data that is not relevant to the query's context. Your response should integrate knowledge from the valid sources you have identified. Additionally, the question might include hypothetical or counterfactual statements. You need to recognize these and adjust your response to provide accurate, relevant information without being misled by the counterfactuals. Question: {question} -""" -document_context = """ -Content: {page_content} +Respond to the question only taking into account the following documents. If no documents are provided, refrain from answering although you may provide an answer if the user explicitely asked for a general answer. You may ask the user to rephrase their question, or their permission to answer without specific documents from your own knowledge. + +Documents: {context} -Source: {source} +Response: """