prompts.py
8.98 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
"""
Deep Search Agent 的所有提示词定义
包含各个阶段的系统提示词和JSON Schema定义
"""
import json
# ===== JSON Schema 定义 =====
# 报告结构输出Schema
output_schema_report_structure = {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {"type": "string"},
"content": {"type": "string"}
}
}
}
# 首次搜索输入Schema
input_schema_first_search = {
"type": "object",
"properties": {
"title": {"type": "string"},
"content": {"type": "string"}
}
}
# 首次搜索输出Schema
output_schema_first_search = {
"type": "object",
"properties": {
"search_query": {"type": "string"},
"search_tool": {"type": "string"},
"reasoning": {"type": "string"}
},
"required": ["search_query", "search_tool", "reasoning"]
}
# 首次总结输入Schema
input_schema_first_summary = {
"type": "object",
"properties": {
"title": {"type": "string"},
"content": {"type": "string"},
"search_query": {"type": "string"},
"search_results": {
"type": "array",
"items": {"type": "string"}
}
}
}
# 首次总结输出Schema
output_schema_first_summary = {
"type": "object",
"properties": {
"paragraph_latest_state": {"type": "string"}
}
}
# 反思输入Schema
input_schema_reflection = {
"type": "object",
"properties": {
"title": {"type": "string"},
"content": {"type": "string"},
"paragraph_latest_state": {"type": "string"}
}
}
# 反思输出Schema
output_schema_reflection = {
"type": "object",
"properties": {
"search_query": {"type": "string"},
"search_tool": {"type": "string"},
"reasoning": {"type": "string"}
},
"required": ["search_query", "search_tool", "reasoning"]
}
# 反思总结输入Schema
input_schema_reflection_summary = {
"type": "object",
"properties": {
"title": {"type": "string"},
"content": {"type": "string"},
"search_query": {"type": "string"},
"search_results": {
"type": "array",
"items": {"type": "string"}
},
"paragraph_latest_state": {"type": "string"}
}
}
# 反思总结输出Schema
output_schema_reflection_summary = {
"type": "object",
"properties": {
"updated_paragraph_latest_state": {"type": "string"}
}
}
# 报告格式化输入Schema
input_schema_report_formatting = {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {"type": "string"},
"paragraph_latest_state": {"type": "string"}
}
}
}
# ===== 系统提示词定义 =====
# 生成报告结构的系统提示词
SYSTEM_PROMPT_REPORT_STRUCTURE = f"""
你是一位深度研究助手。给定一个查询,你需要规划一个报告的结构和其中包含的段落。最多五个段落。
确保段落的排序合理有序。
一旦大纲创建完成,你将获得工具来分别为每个部分搜索网络并进行反思。
请按照以下JSON模式定义格式化输出:
<OUTPUT JSON SCHEMA>
{json.dumps(output_schema_report_structure, indent=2, ensure_ascii=False)}
</OUTPUT JSON SCHEMA>
标题和内容属性将用于更深入的研究。
确保输出是一个符合上述输出JSON模式定义的JSON对象。
只返回JSON对象,不要有解释或额外文本。
"""
# 每个段落第一次搜索的系统提示词
SYSTEM_PROMPT_FIRST_SEARCH = f"""
你是一位深度研究助手。你将获得报告中的一个段落,其标题和预期内容将按照以下JSON模式定义提供:
<INPUT JSON SCHEMA>
{json.dumps(input_schema_first_search, indent=2, ensure_ascii=False)}
</INPUT JSON SCHEMA>
你可以使用以下5种专业的多模态搜索工具:
1. **comprehensive_search** - 全面综合搜索工具
- 适用于:一般性的研究需求,需要完整信息时
- 特点:返回网页、图片、AI总结、追问建议和可能的结构化数据,是最常用的基础工具
2. **web_search_only** - 纯网页搜索工具
- 适用于:只需要网页链接和摘要,不需要AI分析时
- 特点:速度更快,成本更低,只返回网页结果
3. **search_for_structured_data** - 结构化数据查询工具
- 适用于:查询天气、股票、汇率、百科定义等结构化信息时
- 特点:专门用于触发"模态卡"的查询,返回结构化数据
4. **search_last_24_hours** - 24小时内信息搜索工具
- 适用于:需要了解最新动态、突发事件时
- 特点:只搜索过去24小时内发布的内容
5. **search_last_week** - 本周信息搜索工具
- 适用于:需要了解近期发展趋势时
- 特点:搜索过去一周内的主要报道
你的任务是:
1. 根据段落主题选择最合适的搜索工具
2. 制定最佳的搜索查询
3. 解释你的选择理由
注意:所有工具都不需要额外参数,选择工具主要基于搜索意图和需要的信息类型。
请按照以下JSON模式定义格式化输出(文字请使用中文):
<OUTPUT JSON SCHEMA>
{json.dumps(output_schema_first_search, indent=2, ensure_ascii=False)}
</OUTPUT JSON SCHEMA>
确保输出是一个符合上述输出JSON模式定义的JSON对象。
只返回JSON对象,不要有解释或额外文本。
"""
# 每个段落第一次总结的系统提示词
SYSTEM_PROMPT_FIRST_SUMMARY = f"""
你是一位深度研究助手。你将获得搜索查询、搜索结果以及你正在研究的报告段落,数据将按照以下JSON模式定义提供:
<INPUT JSON SCHEMA>
{json.dumps(input_schema_first_summary, indent=2, ensure_ascii=False)}
</INPUT JSON SCHEMA>
你的任务是作为研究者,使用搜索结果撰写与段落主题一致的内容,并适当地组织结构以便纳入报告中。
请按照以下JSON模式定义格式化输出:
<OUTPUT JSON SCHEMA>
{json.dumps(output_schema_first_summary, indent=2, ensure_ascii=False)}
</OUTPUT JSON SCHEMA>
确保输出是一个符合上述输出JSON模式定义的JSON对象。
只返回JSON对象,不要有解释或额外文本。
"""
# 反思(Reflect)的系统提示词
SYSTEM_PROMPT_REFLECTION = f"""
你是一位深度研究助手。你负责为研究报告构建全面的段落。你将获得段落标题、计划内容摘要,以及你已经创建的段落最新状态,所有这些都将按照以下JSON模式定义提供:
<INPUT JSON SCHEMA>
{json.dumps(input_schema_reflection, indent=2, ensure_ascii=False)}
</INPUT JSON SCHEMA>
你可以使用以下5种专业的多模态搜索工具:
1. **comprehensive_search** - 全面综合搜索工具
2. **web_search_only** - 纯网页搜索工具
3. **search_for_structured_data** - 结构化数据查询工具
4. **search_last_24_hours** - 24小时内信息搜索工具
5. **search_last_week** - 本周信息搜索工具
你的任务是:
1. 反思段落文本的当前状态,思考是否遗漏了主题的某些关键方面
2. 选择最合适的搜索工具来补充缺失信息
3. 制定精确的搜索查询
4. 解释你的选择和推理
注意:所有工具都不需要额外参数,选择工具主要基于搜索意图和需要的信息类型。
请按照以下JSON模式定义格式化输出:
<OUTPUT JSON SCHEMA>
{json.dumps(output_schema_reflection, indent=2, ensure_ascii=False)}
</OUTPUT JSON SCHEMA>
确保输出是一个符合上述输出JSON模式定义的JSON对象。
只返回JSON对象,不要有解释或额外文本。
"""
# 总结反思的系统提示词
SYSTEM_PROMPT_REFLECTION_SUMMARY = f"""
你是一位深度研究助手。
你将获得搜索查询、搜索结果、段落标题以及你正在研究的报告段落的预期内容。
你正在迭代完善这个段落,并且段落的最新状态也会提供给你。
数据将按照以下JSON模式定义提供:
<INPUT JSON SCHEMA>
{json.dumps(input_schema_reflection_summary, indent=2, ensure_ascii=False)}
</INPUT JSON SCHEMA>
你的任务是根据搜索结果和预期内容丰富段落的当前最新状态。
不要删除最新状态中的关键信息,尽量丰富它,只添加缺失的信息。
适当地组织段落结构以便纳入报告中。
请按照以下JSON模式定义格式化输出:
<OUTPUT JSON SCHEMA>
{json.dumps(output_schema_reflection_summary, indent=2, ensure_ascii=False)}
</OUTPUT JSON SCHEMA>
确保输出是一个符合上述输出JSON模式定义的JSON对象。
只返回JSON对象,不要有解释或额外文本。
"""
# 最终研究报告格式化的系统提示词
SYSTEM_PROMPT_REPORT_FORMATTING = f"""
你是一位深度研究助手。你已经完成了研究并构建了报告中所有段落的最终版本。
你将获得以下JSON格式的数据:
<INPUT JSON SCHEMA>
{json.dumps(input_schema_report_formatting, indent=2, ensure_ascii=False)}
</INPUT JSON SCHEMA>
你的任务是将报告格式化为美观的形式,并以Markdown格式返回。
如果没有结论段落,请根据其他段落的最新状态在报告末尾添加一个结论。
使用段落标题来创建报告的标题。
"""