From 3b298e19bca737da706dae9f07f7bcd40ad22a18 Mon Sep 17 00:00:00 2001 From: joachim-danswer Date: Thu, 23 Jan 2025 13:23:10 -0800 Subject: [PATCH] change of sub-question answer if no docs recovered --- .../answer_initial_sub_question/nodes/answer_generation.py | 4 ++-- .../onyx/agents/agent_search/shared_graph_utils/prompts.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/onyx/agents/agent_search/deep_search_a/answer_initial_sub_question/nodes/answer_generation.py b/backend/onyx/agents/agent_search/deep_search_a/answer_initial_sub_question/nodes/answer_generation.py index aa0613bd0..e83a8e64b 100644 --- a/backend/onyx/agents/agent_search/deep_search_a/answer_initial_sub_question/nodes/answer_generation.py +++ b/backend/onyx/agents/agent_search/deep_search_a/answer_initial_sub_question/nodes/answer_generation.py @@ -22,7 +22,7 @@ from onyx.agents.agent_search.shared_graph_utils.prompts import ( from onyx.agents.agent_search.shared_graph_utils.prompts import ( ASSISTANT_SYSTEM_PROMPT_PERSONA, ) -from onyx.agents.agent_search.shared_graph_utils.prompts import UNKNOWN_ANSWER +from onyx.agents.agent_search.shared_graph_utils.prompts import NO_RECOVERED_DOCS from onyx.agents.agent_search.shared_graph_utils.utils import get_persona_prompt from onyx.agents.agent_search.shared_graph_utils.utils import parse_question_id from onyx.chat.models import AgentAnswerPiece @@ -47,7 +47,7 @@ def answer_generation( persona_prompt = get_persona_prompt(agent_search_config.search_request.persona) if len(context_docs) == 0: - answer_str = UNKNOWN_ANSWER + answer_str = NO_RECOVERED_DOCS dispatch_custom_event( "sub_answers", AgentAnswerPiece( diff --git a/backend/onyx/agents/agent_search/shared_graph_utils/prompts.py b/backend/onyx/agents/agent_search/shared_graph_utils/prompts.py index 8f256a093..4dbf57221 100644 --- a/backend/onyx/agents/agent_search/shared_graph_utils/prompts.py +++ b/backend/onyx/agents/agent_search/shared_graph_utils/prompts.py @@ -1,6 +1,6 @@ UNKNOWN_ANSWER = "I do not have enough information to answer this question." -NO_RECOVERED_DOCS = "No relevant documents recovered" +NO_RECOVERED_DOCS = "No relevant information recovered" DATE_PROMPT = """Today is {date}.\n\n""" @@ -48,7 +48,7 @@ BASE_RAG_PROMPT = ( question based on the context, say """ + f'"{UNKNOWN_ANSWER}"' + """. - It is a matter of life and death that you do NOT use your internal knowledge, just the provided + It is a matter of life and death that you do NOT use your internal knowledge, just the provided` information! Make sure that you keep all relevant information, specifically as it concerns to the ultimate goal. @@ -660,7 +660,7 @@ The information provided below consists of: IMPORTANT RULES: - If you cannot reliably answer the question solely using the provided information, say that you cannot reliably answer. You may give some additional facts you learned, but do not try to invent an answer. - - If the information is empty or irrelevant, just say """ + - If the information is irrelevant, just say """ + f'"{UNKNOWN_ANSWER}"' + """. - If the information is relevant but not fully conclusive, specify that the information is not conclusive and say why.