This commit is contained in:
WilliamEspegren
2024-05-23 12:03:48 +02:00
parent 70b5a3ab85
commit 5b7276c0bb
3 changed files with 45 additions and 38 deletions

View File

@@ -1,38 +1,30 @@
import os
from crewai_tools.tools.spider_full_tool.spider_full_tool import SpiderFullTool, SpiderFullParams
from crewai import Agent, Task, Crew
def test_spider_tool():
spider_tool = SpiderFullTool()
def test_spider_full_tool():
spider_tool = SpiderFullTool(api_key="your_api_key")
url = "https://spider.cloud"
params = SpiderFullParams(
return_format="markdown"
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("https://spider.cloud", params=params)
docs = spider_tool._run(url=url, params=params)
print(docs)
# 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
# )
# summarize_spider = Task(
# description="Summarize the content of spider.cloud",
# expected_output="A summary that goes over what spider does",
# agent=searcher
# )
# crew = Crew(
# agents=[searcher],
# tasks=[summarize_spider],
# verbose=2
# )
# crew.kickoff()
if __name__ == "__main__":
test_spider_tool()
test_spider_full_tool()