From 06c6a93276c933232f3d4f60c70f804e19747803 Mon Sep 17 00:00:00 2001 From: Rafi Date: Fri, 24 Mar 2023 11:22:35 +0800 Subject: [PATCH] Modify the placeholder of the default prompt for web search to solve the problem of not providing web search results to ChatGPT --- utils/search_prompt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/search_prompt.py b/utils/search_prompt.py index f966ab0..5b0ed3c 100644 --- a/utils/search_prompt.py +++ b/utils/search_prompt.py @@ -10,13 +10,13 @@ def remove_commands(query: str) -> str: def compile_prompt(results: List[SearchResult], query: str, default_prompt: str) -> str: - # default_prompt = "Web search results:\n\n{web_results}\nCurrent date: {current_date}\n\nInstructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.\nQuery: {query}" formatted_results = format_web_results(results) current_date = datetime.now().strftime("%m/%d/%Y") + print(default_prompt) prompt = replace_variables(default_prompt, { - '{web_results}': formatted_results, - '{query}': remove_commands(query), - '{current_date}': current_date + '[web_results]': formatted_results, + '[query]': remove_commands(query), + '[current_date]': current_date }) return prompt