Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fix: rm annotations and use old styles

stellahsra78045d87e66
diff --git a/metagpt/tools/search_engine.py b/metagpt/tools/search_engine.py
index c36be9484..942ef7edd 100644
--- a/metagpt/tools/search_engine.py
+++ b/metagpt/tools/search_engine.py
@@ -5,10 +5,8 @@
@Author : alexanderwu
@File : search_engine.py
"""
-from __future__ import annotations
-
import importlib
-from typing import Callable, Coroutine, Literal, overload
+from typing import Callable, Coroutine, Literal, overload, Optional, Union
from semantic_kernel.skill_definition import sk_function
@@ -45,8 +43,8 @@ class SearchEngine:
def __init__(
self,
- engine: SearchEngineType | None = None,
- run_func: Callable[[str, int, bool], Coroutine[None, None, str | list[str]]] = None,
+ engine: Optional[SearchEngineType] = None,
+ run_func: Callable[[str, int, bool], Coroutine[None, None, Union[str, list[str]]]] = None,
):
engine = engine or CONFIG.search_engine
if engine == SearchEngineType.SERPAPI_GOOGLE:
@@ -86,7 +84,7 @@ class SearchEngine:
) -> list[dict[str, str]]:
...
- async def run(self, query: str, max_results: int = 8, as_string: bool = True) -> str | list[dict[str, str]]:
+ async def run(self, query: str, max_results: int = 8, as_string: bool = True) -> Union[str, list[dict[str, str]]]:
"""Run a search query.
Args: