diff --git a/src/khoj/processor/conversation/offline/utils.py b/src/khoj/processor/conversation/offline/utils.py index 2a3781b3..b711c11a 100644 --- a/src/khoj/processor/conversation/offline/utils.py +++ b/src/khoj/processor/conversation/offline/utils.py @@ -12,8 +12,8 @@ logger = logging.getLogger(__name__) def download_model(repo_id: str, filename: str = "*Q4_K_M.gguf"): from llama_cpp.llama import Llama - # Initialize Model Parameters - kwargs = {"n_threads": 4, "n_ctx": 4096, "verbose": False} + # Initialize Model Parameters. Use n_ctx=0 to get context size from the model + kwargs = {"n_threads": 4, "n_ctx": 0, "verbose": False} # Decide whether to load model to GPU or CPU device = "gpu" if state.chat_on_gpu and state.device != "cpu" else "cpu" diff --git a/src/khoj/processor/conversation/prompts.py b/src/khoj/processor/conversation/prompts.py index 2e9b6715..731813ad 100644 --- a/src/khoj/processor/conversation/prompts.py +++ b/src/khoj/processor/conversation/prompts.py @@ -163,6 +163,7 @@ extract_questions_offline = PromptTemplate.from_template( """ You are Khoj, an extremely smart and helpful search assistant with the ability to retrieve information from the user's notes. Construct search queries to retrieve relevant information to answer the user's question. - You will be provided past questions(Q) and answers(A) for context. +- Try to be as specific as possible. Instead of saying "they" or "it" or "he", use proper nouns like name of the person or thing you are referring to. - Add as much context from the previous questions and answers as required into your search queries. - Break messages into multiple search queries when required to retrieve the relevant information. - Add date filters to your search queries from questions and answers when required to retrieve the relevant information. @@ -217,7 +218,7 @@ User's Location: {location} Q: How was my trip to Cambodia? Khoj: {{"queries": ["How was my trip to Cambodia?"]}} -A: The trip was amazing. I went to the Angkor Wat temple and it was beautiful. +A: The trip was amazing. You went to the Angkor Wat temple and it was beautiful. Q: Who did i visit that temple with? Khoj: {{"queries": ["Who did I visit the Angkor Wat Temple in Cambodia with?"]}} @@ -500,7 +501,6 @@ help_message = PromptTemplate.from_template( - **/image**: Generate an image based on your message. - **/help**: Show this help message. - You are using the **{model}** model on the **{device}**. **version**: {version} """.strip()