diff --git a/gptme/tools/browser.py b/gptme/tools/browser.py index b38a45f..8aca726 100644 --- a/gptme/tools/browser.py +++ b/gptme/tools/browser.py @@ -13,7 +13,7 @@ import subprocess from typing import Literal -from .python import register_function_conditional +from .python import register_function_if has_playwright = importlib.util.find_spec("playwright") is not None @@ -90,7 +90,7 @@ def has_browser_tool(): return has_playwright -@register_function_conditional(has_playwright) +@register_function_if(has_playwright) def read_url(url: str) -> str: """Read the text of a webpage and return the text in Markdown format.""" page = load_page(url) @@ -104,7 +104,7 @@ def read_url(url: str) -> str: return markdown -@register_function_conditional(has_playwright) +@register_function_if(has_playwright) def search(query: str, engine: EngineType = "google") -> str: """Search for a query on a search engine.""" logger.info(f"Searching for '{query}' on {engine}") diff --git a/gptme/tools/python.py b/gptme/tools/python.py index 09e8c02..1bac246 100644 --- a/gptme/tools/python.py +++ b/gptme/tools/python.py @@ -60,7 +60,7 @@ def register_function(func: T) -> T: return func -def register_function_conditional(condition: bool): +def register_function_if(condition: bool): if condition: return register_function else: