Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
hagen-danswer committed Jan 18, 2025
1 parent 46b17e0 commit 84964ca
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions backend/onyx/prompts/prompt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
logger = setup_logger()


MOST_BASIC_PROMPT = "You are a helpful AI assistant."
DANSWER_DATETIME_REPLACEMENT = "[[CURRENT_DATETIME]]"
BASIC_TIME_STR = "The current date is {datetime_info}."
_DANSWER_DATETIME_REPLACEMENT_PAT = "[[CURRENT_DATETIME]]"
_BASIC_TIME_STR = "The current date is {datetime_info}."


def get_current_llm_day_time(
Expand All @@ -39,7 +38,9 @@ def get_current_llm_day_time(


def build_date_time_string() -> str:
return ADDITIONAL_INFO.format(datetime_info=get_current_llm_day_time())
return ADDITIONAL_INFO.format(
datetime_info=_BASIC_TIME_STR.format(datetime_info=get_current_llm_day_time())
)


def handle_onyx_date_awareness(
Expand All @@ -54,13 +55,13 @@ def handle_onyx_date_awareness(
This can later be expanded to support other tags.
"""

if DANSWER_DATETIME_REPLACEMENT in prompt_str:
if _DANSWER_DATETIME_REPLACEMENT_PAT in prompt_str:
return prompt_str.replace(
DANSWER_DATETIME_REPLACEMENT,
_DANSWER_DATETIME_REPLACEMENT_PAT,
get_current_llm_day_time(full_sentence=False, include_day_of_week=True),
)
any_tag_present = any(
DANSWER_DATETIME_REPLACEMENT in text
_DANSWER_DATETIME_REPLACEMENT_PAT in text
for text in [prompt_str, prompt_config.system_prompt, prompt_config.task_prompt]
)
if add_additional_info_if_no_tag and not any_tag_present:
Expand Down

0 comments on commit 84964ca

Please sign in to comment.