Skip to content

Commit 85d0e25

Browse files
committed
reformat all files.
1 parent 1d63a9b commit 85d0e25

File tree

10 files changed

+48
-47
lines changed

10 files changed

+48
-47
lines changed

apps/eval-agent/src/eval_agent/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
56
def hello() -> str:
67
return "Hello from eval-agent!"

apps/run-agent/common_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def load_tasks(self) -> List[BenchmarkTask]:
530530
except json.JSONDecodeError as e:
531531
print(f"Warning: Failed to parse line {i + 1}: {e}")
532532
continue
533-
tasks = tasks[:self.cfg.benchmark.execution.max_tasks]
533+
tasks = tasks[: self.cfg.benchmark.execution.max_tasks]
534534
self.tasks = tasks
535535
print(f"Loaded {len(tasks)} tasks")
536536
return tasks

apps/run-agent/trace_single_task.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ async def single_task(
5353
)
5454

5555

56-
def main(*args, task_id: str = "task_1", task: str="Write a python code to say 'Hello, World!', use python to execute the code.", task_file_name: str = ""):
56+
def main(
57+
*args,
58+
task_id: str = "task_1",
59+
task: str = "Write a python code to say 'Hello, World!', use python to execute the code.",
60+
task_file_name: str = "",
61+
):
5762
print("inside trace")
5863
dotenv.load_dotenv()
5964
with hydra.initialize_config_dir(config_dir=config_path(), version_base=None):

libs/miroflow-contrib/src/miroflow/contrib/pocket/core.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ def _exec(self, prep_res: _PrepResult) -> _ExecResult:
9999
raise RuntimeError("Should not reach here")
100100

101101

102-
class BatchNode[_PrepResult, _ExecResult](
103-
Node[list[_PrepResult] , list[_ExecResult]]
104-
):
102+
class BatchNode[_PrepResult, _ExecResult](Node[list[_PrepResult], list[_ExecResult]]):
105103
def _exec(self, prep_res: list[_PrepResult]) -> list[_ExecResult]:
106104
return [super(BatchNode, self)._exec(i) for i in prep_res]
107105

@@ -139,9 +137,7 @@ def _run(self, shared: SharedData) -> str:
139137
o = self._orch(shared)
140138
return self.post(shared, p, o)
141139

142-
def post(
143-
self, shared: SharedData, prep_res: _PrepResult, exec_res: Any
144-
) -> str:
140+
def post(self, shared: SharedData, prep_res: _PrepResult, exec_res: Any) -> str:
145141
return exec_res
146142

147143

@@ -195,9 +191,7 @@ def _run(self, shared: SharedData) -> str:
195191
raise RuntimeError("Use run_async.")
196192

197193

198-
class AsyncBatchNode(
199-
AsyncNode[list[_PrepResult] | None, list[_ExecResult], str]
200-
):
194+
class AsyncBatchNode(AsyncNode[list[_PrepResult] | None, list[_ExecResult], str]):
201195
async def _exec(self, prep_res: list[_PrepResult] | None) -> list[_ExecResult]:
202196
if prep_res is None:
203197
return []
@@ -215,9 +209,7 @@ async def _exec(self, prep_res: list[_PrepResult] | None) -> list[_ExecResult]:
215209
)
216210

217211

218-
class AsyncFlow(
219-
Flow[_PrepResult, Any], AsyncNode[_PrepResult, Any]
220-
):
212+
class AsyncFlow(Flow[_PrepResult, Any], AsyncNode[_PrepResult, Any]):
221213
async def _orch_async(
222214
self, shared: SharedData, params: Params | None = None
223215
) -> Any:

libs/miroflow-contrib/src/miroflow/contrib/pocket/core_v2.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
A, B = TypeVar("A"), TypeVar("B")
88
Context = Any
99

10-
class Node[A, B](ABC):
1110

11+
class Node[A, B](ABC):
1212
@abstractmethod
1313
def prep(self, ctx: Context) -> A: ...
1414

@@ -23,30 +23,31 @@ def run(self, ctx: Context) -> str:
2323
e = self.exec(p)
2424
return self.post(ctx, p, e)
2525

26+
2627
class Flowable(Protocol):
2728
@property
2829
def successors(self) -> dict[str, "Node[Any, Any]"]: ...
2930

31+
3032
class FlowableMixin:
3133
def handle(self: Flowable, action: str) -> "Node[Any, Any] | None":
3234
return self.successors.get(action, None)
33-
34-
def add_successor(self: Flowable, action: str, node: "Node[Any, Any]") -> "Node[Any, Any]":
35+
36+
def add_successor(
37+
self: Flowable, action: str, node: "Node[Any, Any]"
38+
) -> "Node[Any, Any]":
3539
if action in self.successors:
3640
warnings.warn(f"Overwriting successor for action '{action}'")
3741
self.successors[action] = node
3842
return node
39-
43+
44+
4045
@dataclass
4146
class Flow:
4247
start: Node[Any, Any]
43-
44-
45-
def flow(self, ctx: Context) -> str:
46-
curr,last_action = (
47-
copy.copy(self.start),
48-
"default"
49-
)
48+
49+
def flow(self, ctx: Context) -> str:
50+
curr, last_action = (copy.copy(self.start), "default")
5051
while curr is not None:
5152
last_action = curr.run(ctx)
5253
next_node = curr.successors.get(last_action, None)

libs/miroflow-contrib/tests/test_demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: Apache-2.0
55
# SPDX-License-Identifier: MIT
66

7+
78
def test_hello():
89
assert 1 + 2 == 3, "just a demo"
910

libs/miroflow-tool/tests/test_reading_mcp_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
files_for_tests_dir = os.path.join(current_dir, "files-for-tests")
1818
pytest.skip("Skipping all tests in this file", allow_module_level=True)
1919

20+
2021
class TestReadingMCPServer:
2122
"""Test suite for Reading MCP Server functionality."""
2223

libs/miroflow-tool/tests/test_searching_mcp_server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from mcp import StdioServerParameters
88

99
from miroflow.tool.manager import ToolManager
10-
10+
1111
pytest.skip("Skipping all tests in this file", allow_module_level=True)
12+
13+
1214
class TestSearchingMCPServer:
1315
"""Test suite for Searching MCP Server functionality."""
1416

@@ -654,4 +656,3 @@ async def test_serper_api_key_not_set(self):
654656
def pytest_configure(config):
655657
"""Configure pytest with custom markers."""
656658
config.addinivalue_line("markers", "integration: marks tests as integration tests")
657-

libs/miroflow/src/miroflow/prebuilt/orchestrator.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ async def _get_gaia_answer_type(self, task_description: str) -> str:
694694
Return exactly one of the [number, date, time, string], nothing else.
695695
"""
696696
print(f"Answer type instruction: {instruction}")
697-
697+
698698
message_id = _generate_message_id()
699699
response = await client.chat.completions.create(
700700
model="gpt-4.1",
@@ -704,18 +704,20 @@ async def _get_gaia_answer_type(self, task_description: str) -> str:
704704
# 检查结果是否为空,如果为空则抛出异常触发重试
705705
if not answer_type or not answer_type.strip():
706706
raise ValueError("answer type returned empty result")
707-
707+
708708
print(f"Answer type: {answer_type}")
709-
709+
710710
return answer_type.strip()
711711

712712
@retry(wait=wait_exponential(multiplier=15), stop=stop_after_attempt(5))
713-
async def _o3_extract_gaia_final_answer(self, answer_type: str, task_description_detail: str, summary: str) -> str:
713+
async def _o3_extract_gaia_final_answer(
714+
self, answer_type: str, task_description_detail: str, summary: str
715+
) -> str:
714716
"""使用O3模型从summary中抽取最终答案"""
715717
client = AsyncOpenAI(api_key=self.cfg.env.openai_api_key, timeout=600)
716-
718+
717719
full_prompts = {
718-
"time": f"""# Inputs
720+
"time": f"""# Inputs
719721
720722
* **Original Question**: `{task_description_detail}`
721723
* **Agent Summary**: `{summary}`
@@ -774,8 +776,7 @@ async def _o3_extract_gaia_final_answer(self, answer_type: str, task_description
774776
775777
Return the step-by-step process and your final answer wrapped in \\boxed{{...}}, check the **Formatting rules**, **Additional constraints**, **Common pitfalls to avoid** and **Quick reference examples** step by step, and ensure the answer meet the requirements.
776778
""",
777-
778-
"number": f"""# Inputs
779+
"number": f"""# Inputs
779780
780781
* **Original Question**: `{task_description_detail}`
781782
* **Agent Summary**: `{summary}`
@@ -854,8 +855,7 @@ async def _o3_extract_gaia_final_answer(self, answer_type: str, task_description
854855
855856
Return the step-by-step process and your final answer wrapped in \\boxed{{...}}, check the **Formatting rules**, **Additional constraints**, **Common pitfalls to avoid** and **Quick reference examples** step by step, and ensure the answer meet the requirements.
856857
""",
857-
858-
"string": f"""# Inputs
858+
"string": f"""# Inputs
859859
860860
* **Original Question**: `{task_description_detail}`
861861
* **Agent Summary**: `{summary}`
@@ -940,10 +940,12 @@ async def _o3_extract_gaia_final_answer(self, answer_type: str, task_description
940940
---
941941
# Output
942942
Return the step-by-step process and your final answer wrapped in \\boxed{{...}}, check the **Formatting rules**, **Additional constraints**, **Common pitfalls to avoid** and **Quick reference examples** step by step, and ensure the answer meet the requirements.
943-
"""
944-
}
945-
full_prompt = full_prompts.get(answer_type if answer_type in ["number", "time"] else "string")
946-
943+
""",
944+
}
945+
full_prompt = full_prompts.get(
946+
answer_type if answer_type in ["number", "time"] else "string"
947+
)
948+
947949
print("O3 Extract Final Answer Prompt:")
948950
print(full_prompt)
949951

@@ -959,12 +961,12 @@ async def _o3_extract_gaia_final_answer(self, answer_type: str, task_description
959961
if not result or not result.strip():
960962
raise ValueError("O3 final answer extraction returned empty result")
961963

962-
match = re.search(r'\\boxed{([^}]*)}', result)
964+
match = re.search(r"\\boxed{([^}]*)}", result)
963965
if not match:
964966
raise ValueError("O3 final answer extraction returned empty answer")
965967

966968
print("response:", result)
967-
969+
968970
return result
969971

970972
async def run_main_agent(
@@ -1285,7 +1287,7 @@ async def run_main_agent(
12851287
# 执行O3最终答案提取
12861288
try:
12871289
answer_type = await self._get_gaia_answer_type(task_description)
1288-
1290+
12891291
o3_extracted_answer = await self._o3_extract_gaia_final_answer(
12901292
answer_type,
12911293
task_description,

libs/miroflow/src/miroflow/utils/tool_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def create_mcp_server_parameters(
2929
if logs_dir:
3030
tool_code_env["LOGS_DIR"] = str(logs_dir)
3131

32-
3332
configs.append(
3433
{
3534
"name": "tool-code",
@@ -133,7 +132,6 @@ def create_mcp_server_parameters(
133132
agent_cfg.get("tools", None) is not None
134133
and "tool-browsing" in agent_cfg["tools"]
135134
):
136-
137135
configs.append(
138136
{
139137
"name": "tool-browsing",
@@ -265,4 +263,3 @@ def expose_sub_agents_as_tools(sub_agents_cfg: DictConfig):
265263
)
266264
)
267265
return sub_agents_server_params
268-

0 commit comments

Comments
 (0)