remove full tool, refined tool

This commit is contained in:
WilliamEspegren
2024-05-25 22:22:50 +02:00
parent 5b7276c0bb
commit 56146b7df4
5 changed files with 40 additions and 181 deletions

View File

@@ -1,30 +0,0 @@
from crewai_tools.tools.spider_full_tool.spider_full_tool import SpiderFullTool, SpiderFullParams
def test_spider_full_tool():
spider_tool = SpiderFullTool(api_key="your_api_key")
url = "https://spider.cloud"
params = SpiderFullParams(
request="http",
limit=1,
depth=1,
cache=True,
locale="en-US",
stealth=True,
headers={"User-Agent": "test-agent"},
metadata=False,
viewport="800x600",
encoding="UTF-8",
subdomains=False,
user_agent="test-agent",
store_data=False,
proxy_enabled=False,
query_selector=None,
full_resources=False,
request_timeout=30,
run_in_background=False
)
docs = spider_tool._run(url=url, params=params)
print(docs)
if __name__ == "__main__":
test_spider_full_tool()

View File

@@ -10,22 +10,39 @@ def test_spider_tool():
goal="Find related information from specific URL's",
backstory="An expert web researcher that uses the web extremely well",
tools=[spider_tool],
verbose=True
verbose=True,
cache=False
)
summarize_spider = Task(
description="Summarize the content of spider.cloud",
expected_output="A summary that goes over what spider does",
choose_between_scrape_crawl = Task(
description="Scrape the page of spider.cloud and return a summary of how fast it is",
expected_output="spider.cloud is a fast scraping and crawling tool",
agent=searcher
)
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
)
css_selector = Task(
description="Scrape one page of spider.cloud with the `body > div > main > section.grid.md\:grid-cols-2.gap-10.place-items-center.md\:max-w-screen-xl.mx-auto.pb-8.pt-20 > div:nth-child(1) > h1` CSS selector",
expected_output="The content of the element with the css selector body > div > main > section.grid.md\:grid-cols-2.gap-10.place-items-center.md\:max-w-screen-xl.mx-auto.pb-8.pt-20 > div:nth-child(1) > h1",
agent=searcher
)
crew = Crew(
agents=[searcher],
tasks=[summarize_spider],
tasks=[
choose_between_scrape_crawl,
return_metadata,
css_selector
],
verbose=2
)
crew.kickoff()
if __name__ == "__main__":
test_spider_tool()
test_spider_tool()