Fix extract questions prompt to use YYYY-MM-DD date filter format

This commit is contained in:
Debanjum Singh Solanky
2024-03-15 17:50:33 +05:30
parent bb2693c792
commit 9a068dadbf
3 changed files with 5 additions and 3 deletions

View File

@@ -46,7 +46,8 @@ def extract_questions(
last_new_year = current_new_year.replace(year=today.year - 1)
prompt = prompts.extract_questions.format(
current_date=today.strftime("%A, %Y-%m-%d"),
current_date=today.strftime("%Y-%m-%d"),
day_of_week=today.strftime("%A"),
last_new_year=last_new_year.strftime("%Y"),
last_new_year_date=last_new_year.strftime("%Y-%m-%d"),
current_new_year_date=current_new_year.strftime("%Y-%m-%d"),

View File

@@ -221,8 +221,8 @@ You are Khoj, an extremely smart and helpful search assistant with the ability t
- Break messages into multiple search queries when required to retrieve the relevant information.
- Add date filters to your search queries from questions and answers when required to retrieve the relevant information.
What searches will you need to perform to answer the users question? Respond with search queries as list of strings in a JSON object.
Current Date: {current_date}
What searches will you perform to answer the users question? Respond with search queries as list of strings in a JSON object.
Current Date: {day_of_week}, {current_date}
User's Location: {location}
Q: How was my trip to Cambodia?

View File

@@ -346,6 +346,7 @@ async def extract_references_and_questions(
# Collate search results as context for GPT
with timer("Searching knowledge base took", logger):
result_list = []
logger.info(f"🔍 Searching knowledge base with queries: {inferred_queries}")
for query in inferred_queries:
n_items = min(n, 3) if using_offline_chat else n
result_list.extend(