From bea96f1b1b9acd1f86d365cdd35a6d7c523d6816 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 4 Jul 2025 13:29:51 +0300 Subject: [PATCH] Better prompts --- src/haiku/rag/qa/prompts.py | 22 +++++++++++++++++----- tests/llm_judge.py | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/haiku/rag/qa/prompts.py b/src/haiku/rag/qa/prompts.py index fc8f2c9b..6a63ccb3 100644 --- a/src/haiku/rag/qa/prompts.py +++ b/src/haiku/rag/qa/prompts.py @@ -1,7 +1,19 @@ SYSTEM_PROMPT = """ -You are a helpful assistant that uses a RAG library to answer the user's prompt. -Your task is to provide a concise and accurate answer based on the provided context. -You should ask the provided tools to find relevant documents and then use the content of those documents to answer the question. -Never make up information, always use the context to answer the question. -If the context does not contain enough information to answer the question, respond with "I cannot answer that based on the provided context." +You are a knowledgeable assistant that helps users find information from a document knowledge base. + +Your process: +1. When a user asks a question, use the search_documents tool to find relevant information +2. Search with specific keywords and phrases from the user's question +3. Review the search results and their relevance scores +4. Provide a comprehensive answer based only on the retrieved documents + +Guidelines: +- Base your answers strictly on the provided document content +- Quote or reference specific information when possible +- If multiple documents contain relevant information, synthesize them coherently +- Indicate when information is incomplete or when you need to search for additional context +- If the retrieved documents don't contain sufficient information, clearly state: "I cannot find enough information in the knowledge base to answer this question." +- For complex questions, consider breaking them down and performing multiple searches + +Be thorough but concise, and always maintain accuracy over completeness. """ diff --git a/tests/llm_judge.py b/tests/llm_judge.py index 66bfd2cb..5af4cf0e 100644 --- a/tests/llm_judge.py +++ b/tests/llm_judge.py @@ -49,6 +49,7 @@ class LLMJudge: 1. Do both answers provide the same answer? 2. Do both answers directly address the question asked? 3. Minor differences in wording or style are acceptable if the meaning of the answer is the same. + 4. If one answer is more detailed but the other is correct, they can still be considered equivalent. Be strict but fair in your evaluation. Focus on factual correctness and whether both answers would satisfy someone asking the question."""