Spaces:
Sleeping
Sleeping
File size: 963 Bytes
8469934 717c28a 8469934 ca7d64f 8469934 717c28a d89aafb 8469934 717c28a d89aafb 717c28a d89aafb 717c28a 8469934 717c28a 6b33210 d89aafb 717c28a 9f26975 1d40e2c 8469934 d89aafb 9f26975 1d40e2c 8469934 d89aafb | 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 41 42 43 44 45 | from firecrawl import FirecrawlApp
from pydantic import BaseModel, Field
from typing import List
from smolagents import Tool
import os
#Fetch API key fior firecrawl
api_key = os.getenv("api_key")
class FireCrawlTool(Tool):
name = "firecrawl_website_qa"
description = """
This tool scrapes websites using an API call"""
inputs = {
"website": {
"type": "string",
"description": "A singlular website address",
}
}
output_type = "string"
def forward(self, website: str):
# Initialize the FirecrawlApp with the API key
app = FirecrawlApp(api_key = api_key)
# Scrape a website:
scrape_result = app.scrape_url(website,
params={
'location': {
'country': 'AU'
}
}
)
scrape_result = scrape_result['markdown'][:7000]
return scrape_result |