refined spider_tool.py

This commit is contained in:
WilliamEspegren
2024-05-25 22:40:48 +02:00
parent f0f1ab175a
commit ad965357ce
2 changed files with 30 additions and 2 deletions

View File

@@ -19,7 +19,35 @@ This example shows you how you can use the Spider tool to enable your agent to s
```python ```python
from crewai_tools import SpiderTool from crewai_tools import SpiderTool
tool = SpiderTool() def main():
spider_tool = SpiderTool()
searcher = Agent(
role="Web Research Expert",
goal="Find related information from specific URL's",
backstory="An expert web researcher that uses the web extremely well",
tools=[spider_tool],
verbose=True,
)
return_metadata = Task(
description="Scrape https://spider.cloud with a limit of 1 and enable metadata",
expected_output="Metadata and 10 word summary of spider.cloud",
agent=searcher
)
crew = Crew(
agents=[searcher],
tasks=[
return_metadata,
],
verbose=2
)
crew.kickoff()
if __name__ == "__main__":
main()
``` ```
## Arguments ## Arguments

View File

@@ -13,7 +13,7 @@ class SpiderToolSchema(BaseModel):
) )
mode: Literal["scrape", "crawl"] = Field( mode: Literal["scrape", "crawl"] = Field(
default="scrape", default="scrape",
description="Mode, the only two allowed modes are `scrape` or `crawl`. `scrape` will only scrape the one page of the url provided, while `crawl` will crawl the website following all the subpages found." description="Mode, the only two allowed modes are `scrape` or `crawl`. Use `scrape` to scrape a single page and `crawl` to crawl the entire website following subpages. These modes are the only allowed values even when ANY params is set."
) )
class SpiderTool(BaseTool): class SpiderTool(BaseTool):