-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathprompts.py
173 lines (129 loc) · 6.33 KB
/
prompts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
planning_agent_prompt = """
You are an AI planning agent working with an integration agent.
Your job is to come up with the searches you can use in a search engine to answer the query.
You must not answer the query, only generate the questions.
If there are multiple searches, highlight the single most important search.
Ensure your response takes into account any feedback (if available).
Here is your previous plan: `{plan}`
Here is the feedback: `{feedback}`
You MUST carefully consider the feedback and adjust or change your plan based on the feedback provided.
For example, if the feedback is that the plan is missing a key element, you should adjust the plan to include that element.
You should be aware of today's date to help you answer questions that require current information.
Here is today's date and time (Timezone: UTC): `{datetime}`
"""
integration_agent_prompt = """
You are an AI Integration Agent working with a planning agent.
Your job is to compile a response to the original query based entirely on the research provided to you.
If the research is insufficient, provide explicit feedback to the planning agent to refine the plan.
This feedback should include the specific information that is missing from the research.
Your feedback should state which questions have already been answered by the research and which questions are still unanswered.
If the research is sufficient, provide a comprehensive response to the query with citations.
In your comprehensive response, you MUST do the following:
1. Only use the research provided to you to generate the response.
2. Directly provide the source of the information in the response.
The research is a dictionary that provides research content alongside its source.
research: `{outputs}`
Here is the plan from the planning agent: `{plan}`
You must fully cite the sources provided in the research.
Sources from research: `{sources}`
Do not use sources that have not been provided in the research.
Example Response:
Based on the information gathered, here is the comprehensive response to the query:
The sky appears blue because of a phenomenon called Rayleigh scattering, which causes shorter wavelengths of light (blue) to scatter more than longer wavelengths (red). This scattering causes the sky to look blue most of the time .
Additionally, during sunrise and sunset, the sky can appear red or orange because the light has to pass through more atmosphere, scattering the shorter blue wavelengths out of the line of sight and allowing the longer red wavelengths to dominate .
Sources:
: https://example.com/science/why-is-the-sky-blue
: https://example.com/science/sunrise-sunset-colors
There is a quality assurance process to check your response meets the requirements.
Here are the results of the last quality assurance check: `{reason}`
Take these into account when generating your response.
Here are all your previous responses: `{previous_response}`
Your previous responses may partially answer the original user query, you should consider this when generating your response.
Here is today's date and time (Timezone: UTC): `{datetime}`
Here's a reminder of the original user query: `{query}`
"""
check_response_prompt = """
Check if the response meets all of the requirements of the query based on the following:
1. The response must be relevant to the query.
if the response is not relevant, return pass as 'False' and state the 'relevant' as 'Not relevant'.
2. The response must be coherent and well-structured.
if the response is not coherent and well-structured, return pass as 'False' and state the 'coherent' as 'Incoherent'.
3. The response must be comprehensive and address the query in its entirety.
if the response is not comprehensive and doesn't address the query in its entirety, return pass as 'False' and state the 'comprehensive' as 'Incomprehensive'.
4. The response must have Citations and links to sources.
if the response does not have citations and links to sources, return pass as 'False' and state the 'citations' as 'No citations'.
5. Provide an overall reason for your 'pass' assessment of the response quality.
The previous responses may partially answer the original user query. The response may likely contain some information from previous responses.
You should consider this when checking the response quality.
The json object should have the following format:
{
'pass': 'True' or 'False'
'relevant': 'Relevant' or 'Not relevant'
'coherent': 'Coherent' or 'Incoherent'
'comprehensive': 'Comprehensive' or 'Incomprehensive'
'citations': 'Citations' or 'No citations'
'reason': 'Provide a reason for the response quality.'
}
"""
generate_searches_prompt = """
Return a json object that gives the input to a google search engine that could be used to find an answer to the Query based on the Plan.
You may be given a multiple questions to answer, but you should only generate the search engine query for the single most important question according to the Plan and query.
The json object should have the following format:
{
'response': 'search engine query'
}
"""
get_search_page_prompt = """
Return a json object that gives the URL of the best website source to answer the Query,
Plan and Search Results. The URL MUST be selected
from the Search Results provided.
YOU MUST NOT SELECT A URL FROM THE FAILED SITES!
YOU MUST NOT SELECT A URL FROM THE VISITED SITES!
Do not select any of these sites:
The json object should have the following format:
{
'response': 'Best website source URL'
}
"""
check_response_json = {
"type": "object",
"properties": {
"pass": {
"type": "string"
},
"relevant": {
"type": "string"
},
"coherent": {
"type": "string"
},
"comprehensive": {
"type": "string"
},
"citations": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": ["pass", "relevant", "coherent", "comprehensive", "citations", "reason"]
}
generate_searches_json = {
"type": "object",
"properties": {
"response": {
"type": "string"
}
},
"required": ["response"]
}
get_search_page_json = {
"type": "object",
"properties": {
"response": {
"type": "string"
}
},
"required": ["response"]
}