Skip to content

Commit

Permalink
skip answer verification for idk answers
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-danswer committed Jan 17, 2025
1 parent 38fd061 commit 9d7c337
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
from onyx.agent_search.pro_search_a.answer_initial_sub_question.states import (
QACheckUpdate,
)
from onyx.agent_search.shared_graph_utils.prompts import SUB_CHECK_NO
from onyx.agent_search.shared_graph_utils.prompts import SUB_CHECK_PROMPT
from onyx.agent_search.shared_graph_utils.prompts import UNKNOWN_ANSWER


def answer_check(state: AnswerQuestionState) -> QACheckUpdate:
if state["answer"] == UNKNOWN_ANSWER:
return QACheckUpdate(
answer_quality=SUB_CHECK_NO,
)
msg = [
HumanMessage(
content=SUB_CHECK_PROMPT.format(
Expand Down
9 changes: 7 additions & 2 deletions backend/onyx/agent_search/shared_graph_utils/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@
"""
)

SUB_CHECK_YES = "yes"
SUB_CHECK_NO = "no"

SUB_CHECK_PROMPT = """
SUB_CHECK_PROMPT = (
"""
Your task is to see whether a given answer addresses a given question.
Please do not use any internal knowledge you may have - just focus on whether the answer
as given seems to largely address the question as given, or at least addresses part of the question.
Expand All @@ -92,7 +95,9 @@
\n ------- \n
{base_answer}
\n ------- \n
Does the suggested answer address the question? Please answer with yes or no:"""
Does the suggested answer address the question? Please answer with """
+ f'"{SUB_CHECK_YES}" or "{SUB_CHECK_NO}".'
)


BASE_CHECK_PROMPT = """ \n
Expand Down

0 comments on commit 9d7c337

Please sign in to comment.