From b22a7dae5d70000d0579b7be7e775296ce292f2c Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 14 Mar 2024 16:52:28 +0530 Subject: [PATCH] Tweak prompts to extract information from webpages, online results - Show more of the truncated messages for debugging context - Update Khoj personality prompt to encourage it to remember it's capabilities --- src/khoj/processor/conversation/openai/gpt.py | 2 +- src/khoj/processor/conversation/prompts.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/khoj/processor/conversation/openai/gpt.py b/src/khoj/processor/conversation/openai/gpt.py index c3edf334..178a9e44 100644 --- a/src/khoj/processor/conversation/openai/gpt.py +++ b/src/khoj/processor/conversation/openai/gpt.py @@ -157,7 +157,7 @@ def converse( max_prompt_size, tokenizer_name, ) - truncated_messages = "\n".join({f"{message.content[:40]}..." for message in messages}) + truncated_messages = "\n".join({f"{message.content[:70]}..." for message in messages}) logger.debug(f"Conversation Context for GPT: {truncated_messages}") # Get Response from GPT diff --git a/src/khoj/processor/conversation/prompts.py b/src/khoj/processor/conversation/prompts.py index 1ce0cd49..1f4a0cb9 100644 --- a/src/khoj/processor/conversation/prompts.py +++ b/src/khoj/processor/conversation/prompts.py @@ -10,7 +10,7 @@ You were created by Khoj Inc. with the following capabilities: - You *CAN REMEMBER ALL NOTES and PERSONAL INFORMATION FOREVER* that the user ever shares with you. - Users can share files and other information with you using the Khoj Desktop, Obsidian or Emacs app. They can also drag and drop their files into the chat window. -- You can generate images, look-up information from the internet, and answer questions based on the user's notes. +- You *CAN* generate images, look-up real-time information from the internet, and answer questions based on the user's notes. - You cannot set reminders. - Say "I don't know" or "I don't understand" if you don't know what to say or if you don't know the answer to a question. - Ask crisp follow-up questions to get additional context, when the answer cannot be inferred from the provided notes or past conversations. @@ -146,7 +146,8 @@ online_search_conversation = PromptTemplate.from_template( Use this up-to-date information from the internet to inform your response. Ask crisp follow-up questions to get additional context, when a helpful response cannot be provided from the online data or past conversations. -Information from the internet: {online_results} +Information from the internet: +{online_results} """.strip() ) @@ -280,7 +281,7 @@ Target Query: {query} Web Pages: {corpus} -Collate the relevant information from the website to answer the target query. +Collate only relevant information from the website to answer the target query. """.strip() )