Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywoola committed Sep 15, 2024
1 parent 3ee79d0 commit 824e439
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions api/core/tools/provider/builtin/brave/tools/brave_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ class BraveSearch(BaseModel):
search_wrapper: BraveSearchWrapper

@classmethod
def from_api_key(cls, api_key: str, base_url: str, search_kwargs: Optional[dict] = None,
ensure_ascii: bool = True, **kwargs: Any) -> "BraveSearch":
def from_api_key(
cls, api_key: str, base_url: str, search_kwargs: Optional[dict] = None, ensure_ascii: bool = True, **kwargs: Any
) -> "BraveSearch":
"""Create a tool from an api key.
Args:
Expand All @@ -84,9 +85,9 @@ def from_api_key(cls, api_key: str, base_url: str, search_kwargs: Optional[dict]
Returns:
A tool.
"""
wrapper = BraveSearchWrapper(api_key=api_key, base_url=base_url,
search_kwargs=search_kwargs or {},
ensure_ascii=ensure_ascii)
wrapper = BraveSearchWrapper(
api_key=api_key, base_url=base_url, search_kwargs=search_kwargs or {}, ensure_ascii=ensure_ascii
)
return cls(search_wrapper=wrapper, **kwargs)

def _run(
Expand Down Expand Up @@ -125,9 +126,9 @@ def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMe
if not query:
return self.create_text_message("Please input query")

tool = BraveSearch.from_api_key(api_key=api_key, base_url=base_url,
search_kwargs={"count": count},
ensure_ascii=ensure_ascii)
tool = BraveSearch.from_api_key(
api_key=api_key, base_url=base_url, search_kwargs={"count": count}, ensure_ascii=ensure_ascii
)

results = tool._run(query)

Expand Down

0 comments on commit 824e439

Please sign in to comment.