Skip to content

Commit

Permalink
Citations prompt for slack now includes thread history (#2510)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagen-danswer authored Sep 19, 2024
1 parent f404c4b commit a575d7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/danswer/llm/answering/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def _update_prompt_builder_for_search_tool(
if self.answer_style_config.citation_config
else False
),
history_message=self.single_message_history or "",
)
)
elif self.answer_style_config.quotes_config:
Expand Down
4 changes: 4 additions & 0 deletions backend/danswer/llm/answering/prompts/citations_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
from danswer.prompts.token_counts import CITATION_STATEMENT_TOKEN_CNT
from danswer.prompts.token_counts import LANGUAGE_HINT_TOKEN_CNT
from danswer.search.models import InferenceChunk
from danswer.utils.logger import setup_logger

logger = setup_logger()


def get_prompt_tokens(prompt_config: PromptConfig) -> int:
Expand Down Expand Up @@ -156,6 +159,7 @@ def build_citations_user_message(
user_prompt = CITATIONS_PROMPT_FOR_TOOL_CALLING.format(
task_prompt=task_prompt_with_reminder,
user_query=question,
history_block=history_message,
)

user_prompt = user_prompt.strip()
Expand Down
3 changes: 3 additions & 0 deletions backend/danswer/prompts/direct_qa_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
Refer to the provided context documents when responding to me.{DEFAULT_IGNORE_STATEMENT} \
You should always get right to the point, and never use extraneous language.
CHAT HISTORY:
{{history_block}}
{{task_prompt}}
{QUESTION_PAT.upper()}
Expand Down

0 comments on commit a575d7f

Please sign in to comment.