Spaces:
Configuration error
Configuration error
File size: 1,425 Bytes
eceb45a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | from agency_swarm.tools import BaseTool
from pydantic import Field
import requests
import os
# Assuming Firecrawl API requires an API key
firecrawl_api_key = os.getenv("FIRECRAWL_API_KEY")
firecrawl_base_url = "https://api.firecrawl.com/data"
class FirecrawlDataScraperTool(BaseTool):
"""
This tool interfaces with Firecrawl to gather additional data based on identified gaps or areas needing improvement in the report.
"""
gap_description: str = Field(
..., description="Description of the identified gap or area needing improvement in the report."
)
def run(self):
"""
Interfaces with Firecrawl to gather additional data based on the provided gap description.
"""
# Prepare the request to Firecrawl API
headers = {
"Authorization": f"Bearer {firecrawl_api_key}",
"Content-Type": "application/json"
}
payload = {
"query": self.gap_description
}
# Send the request to Firecrawl API
response = requests.post(firecrawl_base_url, json=payload, headers=headers)
# Check if the request was successful
if response.status_code == 200:
data = response.json()
return f"Data gathered from Firecrawl: {data}"
else:
return f"Failed to gather data from Firecrawl. Status code: {response.status_code}, Error: {response.text}" |