""" 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"}, "start_date": {"type": "string", "description": "开始日期,格式YYYY-MM-DD,仅search_news_by_date工具需要"}, "end_date": {"type": "string", "description": "结束日期,格式YYYY-MM-DD,仅search_news_by_date工具需要"} }, "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"}, "start_date": {"type": "string", "description": "开始日期,格式YYYY-MM-DD,仅search_news_by_date工具需要"}, "end_date": {"type": "string", "description": "结束日期,格式YYYY-MM-DD,仅search_news_by_date工具需要"} }, "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模式定义格式化输出: {json.dumps(output_schema_report_structure, indent=2, ensure_ascii=False)} 标题和内容属性将用于更深入的研究。 确保输出是一个符合上述输出JSON模式定义的JSON对象。 只返回JSON对象,不要有解释或额外文本。 """ # 每个段落第一次搜索的系统提示词 SYSTEM_PROMPT_FIRST_SEARCH = f""" 你是一位深度研究助手。你将获得报告中的一个段落,其标题和预期内容将按照以下JSON模式定义提供: {json.dumps(input_schema_first_search, indent=2, ensure_ascii=False)} 你可以使用以下6种专业的新闻搜索工具: 1. **basic_search_news** - 基础新闻搜索工具 - 适用于:一般性的新闻搜索,不确定需要何种特定搜索时 - 特点:快速、标准的通用搜索,是最常用的基础工具 2. **deep_search_news** - 深度新闻分析工具 - 适用于:需要全面深入了解某个主题时 - 特点:提供最详细的分析结果,包含高级AI摘要 3. **search_news_last_24_hours** - 24小时最新新闻工具 - 适用于:需要了解最新动态、突发事件时 - 特点:只搜索过去24小时的新闻 4. **search_news_last_week** - 本周新闻工具 - 适用于:需要了解近期发展趋势时 - 特点:搜索过去一周的新闻报道 5. **search_images_for_news** - 图片搜索工具 - 适用于:需要可视化信息、图片资料时 - 特点:提供相关图片和图片描述 6. **search_news_by_date** - 按日期范围搜索工具 - 适用于:需要研究特定历史时期时 - 特点:可以指定开始和结束日期进行搜索 - 特殊要求:需要提供start_date和end_date参数,格式为'YYYY-MM-DD' - 注意:只有这个工具需要额外的时间参数 你的任务是: 1. 根据段落主题选择最合适的搜索工具 2. 制定最佳的搜索查询 3. 如果选择search_news_by_date工具,必须同时提供start_date和end_date参数(格式:YYYY-MM-DD) 4. 解释你的选择理由 注意:除了search_news_by_date工具外,其他工具都不需要额外参数。 请按照以下JSON模式定义格式化输出(文字请使用中文): {json.dumps(output_schema_first_search, indent=2, ensure_ascii=False)} 确保输出是一个符合上述输出JSON模式定义的JSON对象。 只返回JSON对象,不要有解释或额外文本。 """ # 每个段落第一次总结的系统提示词 SYSTEM_PROMPT_FIRST_SUMMARY = f""" 你是一位深度研究助手。你将获得搜索查询、搜索结果以及你正在研究的报告段落,数据将按照以下JSON模式定义提供: {json.dumps(input_schema_first_summary, indent=2, ensure_ascii=False)} 你的任务是作为研究者,使用搜索结果撰写与段落主题一致的内容,并适当地组织结构以便纳入报告中。 请按照以下JSON模式定义格式化输出: {json.dumps(output_schema_first_summary, indent=2, ensure_ascii=False)} 确保输出是一个符合上述输出JSON模式定义的JSON对象。 只返回JSON对象,不要有解释或额外文本。 """ # 反思(Reflect)的系统提示词 SYSTEM_PROMPT_REFLECTION = f""" 你是一位深度研究助手。你负责为研究报告构建全面的段落。你将获得段落标题、计划内容摘要,以及你已经创建的段落最新状态,所有这些都将按照以下JSON模式定义提供: {json.dumps(input_schema_reflection, indent=2, ensure_ascii=False)} 你可以使用以下6种专业的新闻搜索工具: 1. **basic_search_news** - 基础新闻搜索工具 2. **deep_search_news** - 深度新闻分析工具 3. **search_news_last_24_hours** - 24小时最新新闻工具 4. **search_news_last_week** - 本周新闻工具 5. **search_images_for_news** - 图片搜索工具 6. **search_news_by_date** - 按日期范围搜索工具(需要时间参数) 你的任务是: 1. 反思段落文本的当前状态,思考是否遗漏了主题的某些关键方面 2. 选择最合适的搜索工具来补充缺失信息 3. 制定精确的搜索查询 4. 如果选择search_news_by_date工具,必须同时提供start_date和end_date参数(格式:YYYY-MM-DD) 5. 解释你的选择和推理 注意:除了search_news_by_date工具外,其他工具都不需要额外参数。 请按照以下JSON模式定义格式化输出: {json.dumps(output_schema_reflection, indent=2, ensure_ascii=False)} 确保输出是一个符合上述输出JSON模式定义的JSON对象。 只返回JSON对象,不要有解释或额外文本。 """ # 总结反思的系统提示词 SYSTEM_PROMPT_REFLECTION_SUMMARY = f""" 你是一位深度研究助手。 你将获得搜索查询、搜索结果、段落标题以及你正在研究的报告段落的预期内容。 你正在迭代完善这个段落,并且段落的最新状态也会提供给你。 数据将按照以下JSON模式定义提供: {json.dumps(input_schema_reflection_summary, indent=2, ensure_ascii=False)} 你的任务是根据搜索结果和预期内容丰富段落的当前最新状态。 不要删除最新状态中的关键信息,尽量丰富它,只添加缺失的信息。 适当地组织段落结构以便纳入报告中。 请按照以下JSON模式定义格式化输出: {json.dumps(output_schema_reflection_summary, indent=2, ensure_ascii=False)} 确保输出是一个符合上述输出JSON模式定义的JSON对象。 只返回JSON对象,不要有解释或额外文本。 """ # 最终研究报告格式化的系统提示词 SYSTEM_PROMPT_REPORT_FORMATTING = f""" 你是一位深度研究助手。你已经完成了研究并构建了报告中所有段落的最终版本。 你将获得以下JSON格式的数据: {json.dumps(input_schema_report_formatting, indent=2, ensure_ascii=False)} 你的任务是将报告格式化为美观的形式,并以Markdown格式返回。 如果没有结论段落,请根据其他段落的最新状态在报告末尾添加一个结论。 使用段落标题来创建报告的标题。 """