From c5fd5196e21d49af9f42ad4f6d5460bb34071652 Mon Sep 17 00:00:00 2001 From: Gui Vieira Date: Wed, 10 Apr 2024 11:48:23 -0300 Subject: [PATCH] Fix tool descriptions --- .../tools/code_docs_search_tool/code_docs_search_tool.py | 1 + src/crewai_tools/tools/csv_search_tool/csv_search_tool.py | 1 + .../tools/directory_search_tool/directory_search_tool.py | 1 + src/crewai_tools/tools/docx_search_tool/docx_search_tool.py | 1 + src/crewai_tools/tools/github_search_tool/README.md | 3 +++ .../tools/github_search_tool/github_search_tool.py | 5 +++-- src/crewai_tools/tools/json_search_tool/json_search_tool.py | 1 + src/crewai_tools/tools/mdx_seach_tool/mdx_search_tool.py | 1 + src/crewai_tools/tools/pdf_search_tool/pdf_search_tool.py | 1 + src/crewai_tools/tools/txt_search_tool/txt_search_tool.py | 1 + src/crewai_tools/tools/website_search/website_search_tool.py | 1 + src/crewai_tools/tools/xml_search_tool/xml_search_tool.py | 1 + .../youtube_channel_search_tool.py | 1 + .../youtube_video_search_tool/youtube_video_search_tool.py | 1 + 14 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/crewai_tools/tools/code_docs_search_tool/code_docs_search_tool.py b/src/crewai_tools/tools/code_docs_search_tool/code_docs_search_tool.py index a5d6e5a21..a69ea7eb4 100644 --- a/src/crewai_tools/tools/code_docs_search_tool/code_docs_search_tool.py +++ b/src/crewai_tools/tools/code_docs_search_tool/code_docs_search_tool.py @@ -34,6 +34,7 @@ class CodeDocsSearchTool(RagTool): self.add(docs_url) self.description = f"A tool that can be used to semantic search a query the {docs_url} Code Docs content." self.args_schema = FixedCodeDocsSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/csv_search_tool/csv_search_tool.py b/src/crewai_tools/tools/csv_search_tool/csv_search_tool.py index fe9617f40..a04f227ca 100644 --- a/src/crewai_tools/tools/csv_search_tool/csv_search_tool.py +++ b/src/crewai_tools/tools/csv_search_tool/csv_search_tool.py @@ -34,6 +34,7 @@ class CSVSearchTool(RagTool): self.add(csv) self.description = f"A tool that can be used to semantic search a query the {csv} CSV's content." self.args_schema = FixedCSVSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/directory_search_tool/directory_search_tool.py b/src/crewai_tools/tools/directory_search_tool/directory_search_tool.py index bb07d44ed..9a988a7fa 100644 --- a/src/crewai_tools/tools/directory_search_tool/directory_search_tool.py +++ b/src/crewai_tools/tools/directory_search_tool/directory_search_tool.py @@ -34,6 +34,7 @@ class DirectorySearchTool(RagTool): self.add(directory) self.description = f"A tool that can be used to semantic search a query the {directory} directory's content." self.args_schema = FixedDirectorySearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/docx_search_tool/docx_search_tool.py b/src/crewai_tools/tools/docx_search_tool/docx_search_tool.py index d79efd82c..e6f5b2d55 100644 --- a/src/crewai_tools/tools/docx_search_tool/docx_search_tool.py +++ b/src/crewai_tools/tools/docx_search_tool/docx_search_tool.py @@ -34,6 +34,7 @@ class DOCXSearchTool(RagTool): self.add(docx) self.description = f"A tool that can be used to semantic search a query the {docx} DOCX's content." self.args_schema = FixedDOCXSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/github_search_tool/README.md b/src/crewai_tools/tools/github_search_tool/README.md index 4550e4224..55e01dd50 100644 --- a/src/crewai_tools/tools/github_search_tool/README.md +++ b/src/crewai_tools/tools/github_search_tool/README.md @@ -19,6 +19,7 @@ from crewai_tools import GithubSearchTool # Initialize the tool for semantic searches within a specific GitHub repository tool = GithubSearchTool( + gh_token='...', github_repo='https://github.com/example/repo', content_types=['code', 'issue'] # Options: code, repo, pr, issue ) @@ -27,11 +28,13 @@ tool = GithubSearchTool( # Initialize the tool for semantic searches within a specific GitHub repository, so the agent can search any repository if it learns about during its execution tool = GithubSearchTool( + gh_token='...', content_types=['code', 'issue'] # Options: code, repo, pr, issue ) ``` ## Arguments +- `gh_token` : The GitHub token used to authenticate the search. This is a mandatory field and allows the tool to access the GitHub API for conducting searches. - `github_repo` : The URL of the GitHub repository where the search will be conducted. This is a mandatory field and specifies the target repository for your search. - `content_types` : Specifies the types of content to include in your search. You must provide a list of content types from the following options: `code` for searching within the code, `repo` for searching within the repository's general information, `pr` for searching within pull requests, and `issue` for searching within issues. This field is mandatory and allows tailoring the search to specific content types within the GitHub repository. 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 1d64bae34..5bfa65542 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 @@ -27,7 +27,7 @@ class GithubSearchToolSchema(FixedGithubSearchToolSchema): class GithubSearchTool(RagTool): name: str = "Search a github repo's content" - description: str = "A tool that can be used to semantic search a query from a github repo's content." + description: str = "A tool that can be used to semantic search a query from a github repo's content. This is not the GitHub API, but instead a tool that can provide semantic search capabilities." summarize: bool = False gh_token: str args_schema: Type[BaseModel] = GithubSearchToolSchema @@ -37,8 +37,9 @@ class GithubSearchTool(RagTool): super().__init__(**kwargs) if github_repo is not None: 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.description = f"A tool that can be used to semantic search a query the {github_repo} github repo's content. This is not the GitHub API, but instead a tool that can provide semantic search capabilities." self.args_schema = FixedGithubSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/json_search_tool/json_search_tool.py b/src/crewai_tools/tools/json_search_tool/json_search_tool.py index 71bda18fb..102cd89ad 100644 --- a/src/crewai_tools/tools/json_search_tool/json_search_tool.py +++ b/src/crewai_tools/tools/json_search_tool/json_search_tool.py @@ -34,6 +34,7 @@ class JSONSearchTool(RagTool): self.add(json_path) self.description = f"A tool that can be used to semantic search a query the {json_path} JSON's content." self.args_schema = FixedJSONSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/mdx_seach_tool/mdx_search_tool.py b/src/crewai_tools/tools/mdx_seach_tool/mdx_search_tool.py index a3a768e99..99bd37348 100644 --- a/src/crewai_tools/tools/mdx_seach_tool/mdx_search_tool.py +++ b/src/crewai_tools/tools/mdx_seach_tool/mdx_search_tool.py @@ -34,6 +34,7 @@ class MDXSearchTool(RagTool): self.add(mdx) self.description = f"A tool that can be used to semantic search a query the {mdx} MDX's content." self.args_schema = FixedMDXSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/pdf_search_tool/pdf_search_tool.py b/src/crewai_tools/tools/pdf_search_tool/pdf_search_tool.py index 47e425a45..af95ae0bf 100644 --- a/src/crewai_tools/tools/pdf_search_tool/pdf_search_tool.py +++ b/src/crewai_tools/tools/pdf_search_tool/pdf_search_tool.py @@ -33,6 +33,7 @@ class PDFSearchTool(RagTool): self.add(pdf) self.description = f"A tool that can be used to semantic search a query the {pdf} PDF's content." self.args_schema = FixedPDFSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/txt_search_tool/txt_search_tool.py b/src/crewai_tools/tools/txt_search_tool/txt_search_tool.py index e8e653061..921e633e8 100644 --- a/src/crewai_tools/tools/txt_search_tool/txt_search_tool.py +++ b/src/crewai_tools/tools/txt_search_tool/txt_search_tool.py @@ -34,6 +34,7 @@ class TXTSearchTool(RagTool): self.add(txt) self.description = f"A tool that can be used to semantic search a query the {txt} txt's content." self.args_schema = FixedTXTSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/website_search/website_search_tool.py b/src/crewai_tools/tools/website_search/website_search_tool.py index 9233e7766..cfe163ae8 100644 --- a/src/crewai_tools/tools/website_search/website_search_tool.py +++ b/src/crewai_tools/tools/website_search/website_search_tool.py @@ -34,6 +34,7 @@ class WebsiteSearchTool(RagTool): self.add(website) self.description = f"A tool that can be used to semantic search a query from {website} website content." self.args_schema = FixedWebsiteSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/xml_search_tool/xml_search_tool.py b/src/crewai_tools/tools/xml_search_tool/xml_search_tool.py index 6caf09971..53fd73248 100644 --- a/src/crewai_tools/tools/xml_search_tool/xml_search_tool.py +++ b/src/crewai_tools/tools/xml_search_tool/xml_search_tool.py @@ -34,6 +34,7 @@ class XMLSearchTool(RagTool): self.add(xml) self.description = f"A tool that can be used to semantic search a query the {xml} XML's content." self.args_schema = FixedXMLSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/youtube_channel_search_tool/youtube_channel_search_tool.py b/src/crewai_tools/tools/youtube_channel_search_tool/youtube_channel_search_tool.py index 1eb89fe56..8e9591be8 100644 --- a/src/crewai_tools/tools/youtube_channel_search_tool/youtube_channel_search_tool.py +++ b/src/crewai_tools/tools/youtube_channel_search_tool/youtube_channel_search_tool.py @@ -34,6 +34,7 @@ class YoutubeChannelSearchTool(RagTool): self.add(youtube_channel_handle) self.description = f"A tool that can be used to semantic search a query the {youtube_channel_handle} Youtube Channels content." self.args_schema = FixedYoutubeChannelSearchToolSchema + self._generate_description() def add( self, diff --git a/src/crewai_tools/tools/youtube_video_search_tool/youtube_video_search_tool.py b/src/crewai_tools/tools/youtube_video_search_tool/youtube_video_search_tool.py index a2dd45661..f1caa1b9c 100644 --- a/src/crewai_tools/tools/youtube_video_search_tool/youtube_video_search_tool.py +++ b/src/crewai_tools/tools/youtube_video_search_tool/youtube_video_search_tool.py @@ -34,6 +34,7 @@ class YoutubeVideoSearchTool(RagTool): self.add(youtube_video_url) self.description = f"A tool that can be used to semantic search a query the {youtube_video_url} Youtube Video content." self.args_schema = FixedYoutubeVideoSearchToolSchema + self._generate_description() def add( self,