From 776826ec992b567718862b8eaf772b8eb7693dd4 Mon Sep 17 00:00:00 2001 From: Gui Vieira Date: Fri, 5 Apr 2024 18:04:45 -0300 Subject: [PATCH] Fix GithubSearchTool --- .../tools/github_search_tool/github_search_tool.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/crewai_tools/tools/github_search_tool/github_search_tool.py b/src/crewai_tools/tools/github_search_tool/github_search_tool.py index eead8e49a..1d64bae34 100644 --- a/src/crewai_tools/tools/github_search_tool/github_search_tool.py +++ b/src/crewai_tools/tools/github_search_tool/github_search_tool.py @@ -36,18 +36,21 @@ class GithubSearchTool(RagTool): def __init__(self, github_repo: Optional[str] = None, **kwargs): super().__init__(**kwargs) if github_repo is not None: - self.add(github_repo) + self.add(repo=github_repo) self.description = f"A tool that can be used to semantic search a query the {github_repo} github repo's content." self.args_schema = FixedGithubSearchToolSchema def add( self, - *args: Any, + repo: str, + content_types: List[str] | None = None, **kwargs: Any, ) -> None: + content_types = content_types or self.content_types + kwargs["data_type"] = "github" kwargs["loader"] = GithubLoader(config={"token": self.gh_token}) - super().add(*args, **kwargs) + super().add(f"repo:{repo} type:{','.join(content_types)}", **kwargs) def _before_run( self, @@ -55,7 +58,9 @@ class GithubSearchTool(RagTool): **kwargs: Any, ) -> Any: if "github_repo" in kwargs: - self.add(kwargs["github_repo"]) + self.add( + repo=kwargs["github_repo"], content_types=kwargs.get("content_types") + ) def _run( self,