"docs/vscode:/vscode.git/clone" did not exist on "d35ea80e666d6984e6bb89720bba7f813cf3caee"
Unverified Commit 17d5eda8 authored by Yuhao Zhou's avatar Yuhao Zhou Committed by GitHub
Browse files

bugfix for undefined logging functions in HarmonyBrowserTool & HarmonyPythonTool (#9229)

parent 71a7f1d8
...@@ -4,6 +4,8 @@ import os ...@@ -4,6 +4,8 @@ import os
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any
from sglang.srt.utils import print_info_once, print_warning_once
if TYPE_CHECKING: if TYPE_CHECKING:
# Avoid circular import. # Avoid circular import.
from sglang.srt.entrypoints.context import ConversationContext from sglang.srt.entrypoints.context import ConversationContext
...@@ -25,7 +27,7 @@ class HarmonyBrowserTool(Tool): ...@@ -25,7 +27,7 @@ class HarmonyBrowserTool(Tool):
exa_api_key = os.getenv("EXA_API_KEY") exa_api_key = os.getenv("EXA_API_KEY")
if not exa_api_key: if not exa_api_key:
self.enabled = False self.enabled = False
logger.warning_once("EXA_API_KEY is not set, browsing is disabled") print_warning_once("EXA_API_KEY is not set, browsing is disabled")
return return
try: try:
...@@ -33,12 +35,12 @@ class HarmonyBrowserTool(Tool): ...@@ -33,12 +35,12 @@ class HarmonyBrowserTool(Tool):
from gpt_oss.tools.simple_browser.backend import ExaBackend from gpt_oss.tools.simple_browser.backend import ExaBackend
except ImportError: except ImportError:
self.enabled = False self.enabled = False
logger.warning_once("gpt_oss is not installed, browsing is disabled") print_warning_once("gpt_oss is not installed, browsing is disabled")
return return
browser_backend = ExaBackend(source="web", api_key=exa_api_key) browser_backend = ExaBackend(source="web", api_key=exa_api_key)
self.browser_tool = SimpleBrowserTool(backend=browser_backend) self.browser_tool = SimpleBrowserTool(backend=browser_backend)
logger.info_once("Browser tool initialized") print_info_once("Browser tool initialized")
async def get_result(self, context: "ConversationContext") -> Any: async def get_result(self, context: "ConversationContext") -> Any:
from sglang.srt.entrypoints.context import HarmonyContext from sglang.srt.entrypoints.context import HarmonyContext
...@@ -64,13 +66,11 @@ class HarmonyPythonTool(Tool): ...@@ -64,13 +66,11 @@ class HarmonyPythonTool(Tool):
from gpt_oss.tools.python_docker.docker_tool import PythonTool from gpt_oss.tools.python_docker.docker_tool import PythonTool
except ImportError: except ImportError:
self.enabled = False self.enabled = False
logger.warning_once( print_warning_once("gpt_oss is not installed, code interpreter is disabled")
"gpt_oss is not installed, code interpreter is disabled"
)
return return
self.python_tool = PythonTool() self.python_tool = PythonTool()
logger.info_once("Code interpreter tool initialized") print_info_once("Code interpreter tool initialized")
async def get_result(self, context: "ConversationContext") -> Any: async def get_result(self, context: "ConversationContext") -> Any:
from sglang.srt.entrypoints.context import HarmonyContext from sglang.srt.entrypoints.context import HarmonyContext
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment