Skip to content

Commit 4fb075a

Browse files
committed
reformat
1 parent ce2bb0d commit 4fb075a

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

src/core/orchestrator.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,25 @@ def _get_query_from_tool_call(
140140
elif tool_name == "wiki_get_page_content":
141141
return "entity:" + arguments.get("entity")
142142
elif tool_name == "search_wiki_revision":
143-
return "entity:" + arguments.get("entity") + "_year:" + str(arguments.get("year")) + "_month:" + str(arguments.get("month"))
143+
return (
144+
"entity:"
145+
+ arguments.get("entity")
146+
+ "_year:"
147+
+ str(arguments.get("year"))
148+
+ "_month:"
149+
+ str(arguments.get("month"))
150+
)
144151
elif tool_name == "search_archived_webpage":
145-
return "url:" + arguments.get("url") + "_year:" + str(arguments.get("year")) + "_month:" + str(arguments.get("month")) + "_day:" + str(arguments.get("day"))
152+
return (
153+
"url:"
154+
+ arguments.get("url")
155+
+ "_year:"
156+
+ str(arguments.get("year"))
157+
+ "_month:"
158+
+ str(arguments.get("month"))
159+
+ "_day:"
160+
+ str(arguments.get("day"))
161+
)
146162
elif tool_name == "scrape_website":
147163
return "url:" + arguments.get("url")
148164
return None
@@ -548,7 +564,9 @@ async def run_sub_agent(
548564
query_str = self._get_query_from_tool_call(tool_name, arguments)
549565
if query_str:
550566
cache_name = sub_agent_name + "_" + tool_name
551-
self.used_queries.setdefault(cache_name, defaultdict(lambda: [0, ""]))
567+
self.used_queries.setdefault(
568+
cache_name, defaultdict(lambda: [0, ""])
569+
)
552570
count = self.used_queries[cache_name][query_str][0]
553571
cache_result = self.used_queries[cache_name][query_str][1]
554572
if count > 0:
@@ -565,7 +583,9 @@ async def run_sub_agent(
565583
sub_agent_name
566584
].execute_tool_call(server_name, tool_name, arguments)
567585
if "error" not in tool_result:
568-
self.used_queries[cache_name][query_str][1] = tool_result["result"]
586+
self.used_queries[cache_name][query_str][1] = (
587+
tool_result["result"]
588+
)
569589
self.used_queries[cache_name][query_str][0] += 1
570590
else:
571591
tool_result = await self.sub_agent_tool_managers[
@@ -934,12 +954,12 @@ async def run_main_agent(
934954
"result": sub_agent_result,
935955
}
936956
else:
937-
query_str = self._get_query_from_tool_call(
938-
tool_name, arguments
939-
)
957+
query_str = self._get_query_from_tool_call(tool_name, arguments)
940958
if query_str:
941959
cache_name = "main_" + tool_name
942-
self.used_queries.setdefault(cache_name, defaultdict(lambda: [0, ""]))
960+
self.used_queries.setdefault(
961+
cache_name, defaultdict(lambda: [0, ""])
962+
)
943963
count = self.used_queries[cache_name][query_str][0]
944964
cache_result = self.used_queries[cache_name][query_str][1]
945965
if count > 0:
@@ -952,17 +972,17 @@ async def run_main_agent(
952972
should_hard_stop = True
953973
self.used_queries[cache_name][query_str][0] += 1
954974
else:
955-
tool_result = (
956-
await self.main_agent_tool_manager.execute_tool_call(
957-
server_name=server_name,
958-
tool_name=tool_name,
959-
arguments=arguments,
960-
)
975+
tool_result = await self.main_agent_tool_manager.execute_tool_call(
976+
server_name=server_name,
977+
tool_name=tool_name,
978+
arguments=arguments,
961979
)
962980
if "error" not in tool_result:
963-
self.used_queries[cache_name][query_str][1] = tool_result["result"]
981+
self.used_queries[cache_name][query_str][1] = (
982+
tool_result["result"]
983+
)
964984
self.used_queries[cache_name][query_str][0] += 1
965-
else:
985+
else:
966986
tool_result = (
967987
await self.main_agent_tool_manager.execute_tool_call(
968988
server_name=server_name,

src/llm/providers/mirothinker_sglang_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async def _create_message(
141141
"LLM finish_reason is 'stop', but content is empty, triggering Error"
142142
)
143143
raise Exception("LLM finish_reason is 'stop', but content is empty")
144-
144+
145145
# identify repeated messages and retry
146146
# Check if the last 100 characters of the response appear more than 5 times in the response content.
147147
# If so, treat it as a severe repeat and trigger a retry.

0 commit comments

Comments
 (0)