diff --git a/prompting/tasks/qa.py b/prompting/tasks/qa.py index 2fa293087..d8a6e91a8 100644 --- a/prompting/tasks/qa.py +++ b/prompting/tasks/qa.py @@ -22,10 +22,11 @@ # Used to obtain the query (which is a followup question about the context) # TODO: we may not need the entire conversation history - we can sample a subset of it (first k messages, last k messages, etc.) FOLLOWUP_PROMPT_TEMPLATE = """ -Compose a single, specific question to continue the dialogue below. Adopt the persona of the original user, including their communication style and objectives. The question should be based on the previous exchanges and must not be answerable with a simple yes or no. +Compose a single, specific question to continue the dialogue below. Adopt the persona of the original user, reflecting their communication style and objectives. The question should be rooted in the previous exchanges and should not be answerable with a simple yes or no. -The question should require detailed knowledge of the conversation history for a correct response, emphasizing requests for clarification or additional details (e.g., 'What specific steps did you take?' or 'How did that situation resolve?'). Avoid referring to the subject by name and instead use indirect pronouns or descriptions (e.g., 'he,' 'she,' 'it'). Avoid answering the question yourself and refrain from providing new information not already discussed. +Ensure the question requires detailed knowledge of the conversation history for a correct response, focusing on requests for clarification or additional details (e.g., 'What specific steps did you take?', 'Are you sure?', 'How do you know that is true', or 'How did that situation resolve?'). Use indirect pronouns or descriptions to refer to subjects instead of their names. Avoid answering the question yourself and do not introduce new information not already discussed. +When asking a followup question, you should use pronouns or descriptions to refer to subjects instead of their names. You absolutely must not repeat the subject of the question in the followup question. For example, if the question is "What is the capital of France?", the followup question should not be "What is the population of France?". Instead, it should be "How many people live there?" or "What is its population?". # Context: {context} @@ -33,6 +34,7 @@ {history} """ + # Used to obtain reference answer REFERENCE_PROMPT_TEMPLATE = """\ Answer the question you will receive in detail, utilizing the following context. @@ -45,18 +47,20 @@ """ # TODO: We also need a special followup reference prompt (or just merge both) -# Used to obtain reference answer +# TODO: We should create followups using the specified llama3 chat template rather than feeding the message history through textually FOLLOWUP_REFERENCE_PROMPT_TEMPLATE = """\ -Answer the question you will receive in detail, utilizing the following context and conversation history as required. - -#Context: -{context} +You are a helpful assistant. Answer the question below in detail, prioritizing the use of the provided conversation history. The context is available for additional information if needed, but it may not always be relevant. # Conversation History: {history} +# Context (optional): +{context} + # Question: {question} + +Ensure your answer references relevant parts of the conversation history. Use the context only if it provides additional necessary information. """ @dataclass