yonikremer
commited on
Commit
•
8d0a0d3
1
Parent(s):
4b6c061
extracted a constant
Browse files- prompt_engeneering.py +8 -2
prompt_engeneering.py
CHANGED
@@ -4,6 +4,13 @@ from typing import Generator
|
|
4 |
|
5 |
import requests
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
@dataclass
|
9 |
class SearchResult:
|
@@ -48,6 +55,5 @@ def rewrite_prompt(
|
|
48 |
raw_results = get_web_search_results(prompt, num_results)
|
49 |
formatted_results = "Web search results: " + format_search_result(raw_results)
|
50 |
formatted_date = "Current date: " + datetime.now().strftime("%d/%m/%Y")
|
51 |
-
default_instructions = "Instructions: 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."
|
52 |
formatted_prompt = f"Query: {prompt}"
|
53 |
-
return "\n".join([formatted_results, formatted_date,
|
|
|
4 |
|
5 |
import requests
|
6 |
|
7 |
+
INSTRUCTIONS = "Instructions: " \
|
8 |
+
"Using the provided web search results, " \
|
9 |
+
"write a comprehensive reply to the given query. " \
|
10 |
+
"Make sure to cite results using [[number](URL)] notation after the reference. " \
|
11 |
+
"If the provided search results refer to multiple subjects with the same name, " \
|
12 |
+
"write separate answers for each subject."
|
13 |
+
|
14 |
|
15 |
@dataclass
|
16 |
class SearchResult:
|
|
|
55 |
raw_results = get_web_search_results(prompt, num_results)
|
56 |
formatted_results = "Web search results: " + format_search_result(raw_results)
|
57 |
formatted_date = "Current date: " + datetime.now().strftime("%d/%m/%Y")
|
|
|
58 |
formatted_prompt = f"Query: {prompt}"
|
59 |
+
return "\n".join([formatted_results, formatted_date, INSTRUCTIONS, formatted_prompt])
|