Skip to content

Commit 917238e

Browse files
authored
Merge pull request #13 from MiroMindAI/test/yfd
feat(agent): add regex boxed extractor
2 parents 176e761 + a1450e6 commit 917238e

8 files changed

+828
-12
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
defaults:
2+
- benchmark: gaia-validation-text-only
3+
- override hydra/job_logging: none
4+
- _self_
5+
6+
entrypoint: main_agent
7+
main_agent:
8+
name: main_agent
9+
type: IterativeAgentWithToolAndRollback
10+
max_consecutive_rollbacks: 3
11+
max_turns: 200
12+
llm:
13+
_base_: config/llm/base_mirothinker.yaml
14+
prompt: config/prompts/fangda_prompt_main_agent_0128.yaml
15+
tools:
16+
- config/tool/tool-search-and-scrape-webpage.yaml
17+
- config/tool/tool-jina-scrape-llm-summary.yaml
18+
- config/tool/tool-python.yaml
19+
tool_blacklist:
20+
- server: "tool-search-and-scrape-webpage"
21+
tool: "sogou_search"
22+
- server: "tool-python"
23+
tool: "download_file_from_sandbox_to_local"
24+
input_processor:
25+
- ${input-message-generator}
26+
output_processor:
27+
- ${output-summary}
28+
- ${output-final-answer-extraction}
29+
- ${output-exceed-max-turn-summary}
30+
31+
input-message-generator:
32+
type: InputMessageGenerator
33+
output-summary:
34+
type: SummaryGenerator
35+
output-final-answer-extraction:
36+
type: RegexBoxedExtractor
37+
output-exceed-max-turn-summary:
38+
type: ExceedMaxTurnSummaryGenerator
39+
prompt: config/prompts/fangda_prompt_main_agent_0128.yaml
40+
llm:
41+
_base_: config/llm/base_mirothinker.yaml
42+
43+
output_dir: logs/
44+
data_dir: "${oc.env:DATA_DIR,data}"
45+
46+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
defaults:
2+
- benchmark: gaia-validation
3+
- override hydra/job_logging: none
4+
- _self_
5+
6+
entrypoint: main_agent
7+
main_agent:
8+
name: main_agent
9+
type: IterativeAgentWithToolAndRollback
10+
max_consecutive_rollbacks: 3
11+
max_turns: 200
12+
llm:
13+
_base_: config/llm/base_mirothinker.yaml
14+
prompt: config/prompts/fangda_prompt_main_agent_0128.yaml
15+
tools:
16+
- config/tool/tool-search-and-scrape-webpage.yaml
17+
- config/tool/tool-jina-scrape-llm-summary.yaml
18+
- config/tool/tool-python.yaml
19+
tool_blacklist:
20+
- server: "tool-search-and-scrape-webpage"
21+
tool: "sogou_search"
22+
- server: "tool-python"
23+
tool: "download_file_from_sandbox_to_local"
24+
input_processor:
25+
- ${input-message-generator}
26+
output_processor:
27+
- ${output-summary}
28+
- ${output-final-answer-extraction}
29+
- ${output-exceed-max-turn-summary}
30+
31+
input-message-generator:
32+
type: InputMessageGenerator
33+
output-summary:
34+
type: SummaryGenerator
35+
output-final-answer-extraction:
36+
type: RegexBoxedExtractor
37+
output-exceed-max-turn-summary:
38+
type: ExceedMaxTurnSummaryGenerator
39+
prompt: config/prompts/fangda_prompt_main_agent_0128.yaml
40+
llm:
41+
_base_: config/llm/base_mirothinker.yaml
42+
43+
output_dir: logs/
44+
data_dir: "${oc.env:DATA_DIR,data}"
45+
46+
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
template:
2+
initial_user_text:
3+
components:
4+
- task_description
5+
- file_input_prompt
6+
- task_guidance
7+
- chinese_context_extra_prompt
8+
- task_hint
9+
10+
required_context:
11+
- task_description
12+
13+
optional_context:
14+
- file_input
15+
- chinese_context
16+
- task_hint
17+
18+
task_description: |
19+
{{ task_description }}
20+
21+
file_input_prompt: |
22+
{% if file_input is defined and file_input is not none and file_input.file_name is defined and file_input.file_name %}
23+
Note: A {{ file_input.file_type }} file '{{ file_input.file_name }}' is associated with this task. If you need worker agent to read its content, you should provide the complete local system file path: {{ file_input.absolute_file_path }}.\n\n
24+
{% endif %}
25+
26+
task_guidance: |
27+
You should follow the format instruction in the request strictly and wrap the final answer in \\boxed{}.
28+
29+
chinese_context_extra_prompt: |
30+
{% if chinese_context is defined and chinese_context %}
31+
## 中文任务处理指导
32+
If the task involves Chinese context, please follow the following instructions:
33+
- **信息收集策略**:使用中文关键词进行网络搜索,优先浏览中文网页,以获取更准确和全面的中文资源
34+
- **思考过程**:所有分析、推理、判断等思考过程都应使用中文表达,保持语义的一致性
35+
- **候选答案收集**:对于中文问题,收集所有可能的中文答案选项,包括不同的表达方式和格式
36+
- **证据文档化**:保持中文资源的原始格式,避免不必要的翻译或改写,确保信息的准确性
37+
- **不确定性标注**:使用中文清晰地标记任何不确定性、冲突信息或需要进一步验证的内容
38+
- **结果组织**:以中文组织和呈现最终报告,使用恰当的中文术语和表达习惯
39+
- **过程透明化**:所有步骤描述、状态更新、中间结果等都应使用中文,确保用户理解
40+
{% endif %}
41+
42+
task_hint: |
43+
{% if task_hint is defined and task_hint %}
44+
Before you begin, please review the following preliminary notes highlighting subtle or easily misunderstood points in the question, which might help you avoid common pitfalls during your analysis (for reference only; these may not be exhaustive):
45+
{{ task_hint }}
46+
{% endif %}
47+
48+
system_prompt:
49+
components:
50+
- basic_system_prompt
51+
- chinese_context_extra_prompt
52+
53+
required_context:
54+
- formatted_date
55+
- mcp_server_definitions
56+
57+
optional_context:
58+
- chinese_context
59+
60+
basic_system_prompt: |
61+
In this environment you have access to a set of tools you can use to answer the user's question.
62+
63+
You only have access to the tools provided below. You can only use one tool per message, and will receive the result of that tool in the user's next response. You use tools step-by-step to accomplish a given task, with each tool-use informed by the result of the previous tool-use. Today is: {{ formatted_date }}
64+
65+
# Tool-Use Formatting Instructions
66+
67+
Tool-use is formatted using XML-style tags. The tool-use is enclosed in <use_mcp_tool></use_mcp_tool> and each parameter is similarly enclosed within its own set of tags.
68+
69+
The Model Context Protocol (MCP) connects to servers that provide additional tools and resources to extend your capabilities. You can use the server's tools via the `use_mcp_tool`.
70+
71+
Description:
72+
Request to use a tool provided by a MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters.
73+
74+
Parameters:
75+
- server_name: (required) The name of the MCP server providing the tool
76+
- tool_name: (required) The name of the tool to execute
77+
- arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema, quotes within string must be properly escaped, ensure it's valid JSON
78+
79+
Usage:
80+
<use_mcp_tool>
81+
<server_name>server name here</server_name>
82+
<tool_name>tool name here</tool_name>
83+
<arguments>
84+
{% raw %}
85+
{{
86+
"param1": "value1",
87+
"param2": "value2 \\"escaped string\\""
88+
}}
89+
{% endraw %}
90+
</arguments>
91+
</use_mcp_tool>
92+
93+
Important Notes:
94+
- Tool-use must be placed **at the end** of your response, **top-level**, and not nested within other tags.
95+
- Always adhere to this format for the tool use to ensure proper parsing and execution.
96+
97+
String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.
98+
Here are the functions available in JSONSchema format:
99+
100+
{{ mcp_server_definitions }}
101+
102+
# General Objective
103+
104+
You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically.
105+
106+
# Agent Specific Objective
107+
108+
You are a task-solving agent that uses tools step-by-step to answer the user's question. Your goal is to provide complete, accurate and well-reasoned answers using additional tools.
109+
110+
chinese_context_extra_prompt: |
111+
{% if chinese_context is defined and chinese_context %}
112+
## 中文语境处理指导
113+
114+
当处理中文相关的任务时:
115+
1. **子任务委托 (Subtask Delegation)**:向worker代理委托的子任务应使用中文描述,确保任务内容准确传达
116+
2. **搜索策略 (Search Strategy)**:搜索关键词应使用中文,以获取更准确的中文内容和信息
117+
3. **问题分析 (Question Analysis)**:对中文问题的分析和理解应保持中文语境
118+
4. **思考过程 (Thinking Process)**:内部分析、推理、总结等思考过程都应使用中文,保持语义表达的一致性
119+
5. **信息整理 (Information Organization)**:从中文资源获取的信息应保持中文原文,避免不必要的翻译
120+
6. **各种输出 (All Outputs)**:所有输出内容包括步骤说明、状态更新、中间结果等都应使用中文
121+
7. **最终答案 (Final Answer)**:对于中文语境的问题,最终答案应使用中文回应
122+
{% endif %}
123+
124+
summarize_prompt:
125+
components:
126+
- basic_summarize_prompt
127+
- chinese_context_extra_prompt
128+
129+
required_context:
130+
- task_description
131+
132+
optional_context:
133+
- chinese_context
134+
- task_failed
135+
136+
basic_summarize_prompt: |
137+
Summarize the above conversation, and output the FINAL ANSWER to the original question.
138+
139+
If a clear answer has already been provided earlier in the conversation, do not rethink or recalculate it — simply extract that answer and reformat it to match the required format below.
140+
If a definitive answer could not be determined, make a well-informed educated guess based on the conversation.
141+
142+
The original question is repeated here for reference:
143+
144+
"{{ task_description }}"
145+
146+
Wrap your final answer in \boxed{}.
147+
Your final answer should be:
148+
- a number, OR
149+
- as few words as possible, OR
150+
- a comma-separated list of numbers and/or strings.
151+
152+
ADDITIONALLY, your final answer MUST strictly follow any formatting instructions in the original question — such as alphabetization, sequencing, units, rounding, decimal places, etc.
153+
If you are asked for a number, express it numerically (i.e., with digits rather than words), don't use commas, and DO NOT INCLUDE UNITS such as $ or USD or percent signs unless specified otherwise.
154+
If you are asked for a string, don't use articles or abbreviations (e.g. for cities), unless specified otherwise. Don't output any final sentence punctuation such as '.', '!', or '?'.
155+
If you are asked for a comma-separated list, apply the above rules depending on whether the elements are numbers or strings.
156+
Do NOT include any punctuation such as '.', '!', or '?' at the end of the answer.
157+
Do NOT include any invisible or non-printable characters in the answer output.
158+
159+
chinese_context_extra_prompt: |
160+
{% if chinese_context is defined and chinese_context %}
161+
## 中文总结要求
162+
If the task involves Chinese context:
163+
- **总结语言**:使用中文进行总结和回答
164+
- **思考过程**:回顾和总结思考过程时也应使用中文表达
165+
- **信息组织**:保持中文信息的原始格式和表达方式
166+
- **过程描述**:对工作历史、步骤描述、结果分析等各种输出都应使用中文
167+
{% endif %}
168+
169+
hint_generation_prompt:
170+
components:
171+
- basic_hint_generation_prompt
172+
173+
required_context:
174+
- task_description
175+
176+
optional_context:
177+
- chinese_context
178+
179+
basic_hint_generation_prompt: |
180+
Carefully analyze the given task description (question) without attempting to solve it directly. Your role is to identify potential challenges and areas that require special attention during the solving process, and provide practical guidance for someone who will solve this task by actively gathering and analyzing information from the web.
181+
182+
Identify and concisely list key points in the question that could potentially impact subsequent information collection or the accuracy and completeness of the problem solution, especially those likely to cause mistakes, carelessness, or confusion during problem-solving.
183+
184+
The question author does not intend to set traps or intentionally create confusion. Interpret the question in the most common, reasonable, and straightforward manner, without speculating about hidden meanings or unlikely scenarios. However, be aware that mistakes, imprecise wording, or inconsistencies may exist due to carelessness or limited subject expertise, rather than intentional ambiguity.
185+
186+
Additionally, when considering potential answers or interpretations, note that question authors typically favor more common and familiar expressions over overly technical, formal, or obscure terminology. They generally prefer straightforward and common-sense interpretations rather than being excessively cautious or academically rigorous in their wording choices.
187+
188+
Also, consider additional flagging issues such as:
189+
- Potential mistakes or oversights introduced unintentionally by the question author due to his misunderstanding, carelessness, or lack of attention to detail.
190+
- Terms or instructions that might have multiple valid interpretations due to ambiguity, imprecision, outdated terminology, or subtle wording nuances.
191+
- Numeric precision, rounding requirements, formatting, or units that might be unclear, erroneous, or inconsistent with standard practices or provided examples.
192+
- Contradictions or inconsistencies between explicit textual instructions and examples or contextual clues provided within the question itself.
193+
194+
Do NOT attempt to guess or infer correct answers, as complete factual information is not yet available. Your responsibility is purely analytical, proactively flagging points that deserve special attention or clarification during subsequent information collection and task solving. Avoid overanalyzing or listing trivial details that would not materially affect the task outcome.
195+
196+
Here is the question:
197+
{{ task_description }}
198+
199+
{% if chinese_context is defined and chinese_context %}
200+
## 中文分析指导
201+
如果问题涉及中文语境,请特别注意:
202+
- **语言理解**:识别可能存在的中文表达歧义、方言差异或特定语境下的含义
203+
- **文化背景**:考虑可能需要中文文化背景知识才能正确理解的术语或概念
204+
- **信息获取**:标注需要使用中文搜索关键词才能获得准确信息的方面
205+
- **格式要求**:识别中文特有的格式要求、表达习惯或答案形式
206+
- **翻译风险**:标记直接翻译可能导致误解或信息丢失的关键术语
207+
- **时效性**:注意中文信息源的时效性和地域性特征
208+
- **分析输出**:使用中文进行分析和提示,确保语言一致性
209+
{% endif %}

0 commit comments

Comments
 (0)