Update some of the extract question prompts for llamav2

This commit is contained in:
sabaimran 2023-08-01 12:23:36 -07:00
parent b11b00a9ff
commit f409e16137

View file

@ -19,14 +19,13 @@ Question: {query}
) )
system_prompt_message_llamav2 = f"""You are Khoj, a friendly, smart and helpful personal assistant. system_prompt_message_llamav2 = f"""You are Khoj, a friendly, smart and helpful personal assistant.
Using your general knowledge and our past conversations as context, answer the following question.""" Using your general knowledge and our past conversations as context, answer the following question.
If you do not know the answer, say 'I don't know.'"""
system_prompt_message_extract_questions_llamav2 = f"""You are Khoj, a kind and intelligent personal assistant. system_prompt_message_extract_questions_llamav2 = f"""You are Khoj, a kind and intelligent personal assistant. When the user asks you a question, you ask follow-up questions to clarify the necessary information you need in order to answer from the user's perspective.
- When the user asks you a question, you ask follow-up questions to clarify the necessary information you need in order to answer from the user's perspective.
- Try to be as specific as possible. For example, rather than use "they" or "it", use the name of the person or thing you are referring to.
- Write the question as if you can search for the answer on the user's personal notes. - Write the question as if you can search for the answer on the user's personal notes.
- Try to be as specific as possible. Instead of saying "they" or "it" or "he", use the name of the person or thing you are referring to. For example, instead of saying "Which store did they go to?", say "Which store did Alice and Bob go to?".
- Add as much context from the previous questions and notes as required into your search queries. - Add as much context from the previous questions and notes as required into your search queries.
- Add date filters to your search queries from questions and answers when required to retrieve the relevant information.
- Provide search queries as a list of questions - Provide search queries as a list of questions
What follow-up questions, if any, will you need to ask to answer the user's question? What follow-up questions, if any, will you need to ask to answer the user's question?
""" """
@ -129,11 +128,6 @@ Answer (in second person):"""
extract_questions_llamav2_sample = PromptTemplate.from_template( extract_questions_llamav2_sample = PromptTemplate.from_template(
""" """
<s>[INST]<<SYS>>Current Date: {current_date}<</SYS>>[/INST]</s> <s>[INST]<<SYS>>Current Date: {current_date}<</SYS>>[/INST]</s>
<s>[INST]<<SYS>>
Use these notes from the user's previous conversations to provide a response:
{chat_history}
<</SYS>>[/INST]</s>
<s>[INST]How was my trip to Cambodia?[/INST][]</s> <s>[INST]How was my trip to Cambodia?[/INST][]</s>
<s>[INST]Who did I visit the temple with on that trip?[/INST]Who did I visit the temple with in Cambodia?</s> <s>[INST]Who did I visit the temple with on that trip?[/INST]Who did I visit the temple with in Cambodia?</s>
<s>[INST]How should I take care of my plants?[/INST]What kind of plants do I have? What issues do my plants have?</s> <s>[INST]How should I take care of my plants?[/INST]What kind of plants do I have? What issues do my plants have?</s>
@ -141,6 +135,10 @@ Use these notes from the user's previous conversations to provide a response:
<s>[INST]What did I do for Christmas last year?[/INST]What did I do for Christmas {last_year} dt>='{last_christmas_date}' dt<'{next_christmas_date}'</s> <s>[INST]What did I do for Christmas last year?[/INST]What did I do for Christmas {last_year} dt>='{last_christmas_date}' dt<'{next_christmas_date}'</s>
<s>[INST]How are you feeling today?[/INST]</s> <s>[INST]How are you feeling today?[/INST]</s>
<s>[INST]Is Alice older than Bob?[/INST]When was Alice born? What is Bob's age?</s> <s>[INST]Is Alice older than Bob?[/INST]When was Alice born? What is Bob's age?</s>
<s>[INST]<<SYS>>
Use these notes from the user's previous conversations to provide a response:
{chat_history}
<</SYS>>[/INST]</s>
<s>[INST]{query}[/INST] <s>[INST]{query}[/INST]
""" """
) )