Skip to content

Commit

Permalink
fix: renamed register_function_conditional to register_function_if
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Mar 21, 2024
1 parent f4688ae commit e256fc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions gptme/tools/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion gptme/tools/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e256fc9

Please sign in to comment.