mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Fix pydantic related errors.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Type
|
from typing import TYPE_CHECKING, Any, Dict, Optional, Type
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field, ConfigDict
|
||||||
|
|
||||||
from crewai_tools.tools.base_tool import BaseTool
|
from crewai_tools.tools.base_tool import BaseTool
|
||||||
|
|
||||||
@@ -20,6 +20,11 @@ class FirecrawlCrawlWebsiteToolSchema(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class FirecrawlCrawlWebsiteTool(BaseTool):
|
class FirecrawlCrawlWebsiteTool(BaseTool):
|
||||||
|
model_config = ConfigDict(
|
||||||
|
arbitrary_types_allowed=True,
|
||||||
|
validate_assignment=True,
|
||||||
|
frozen=False
|
||||||
|
)
|
||||||
name: str = "Firecrawl web crawl tool"
|
name: str = "Firecrawl web crawl tool"
|
||||||
description: str = "Crawl webpages using Firecrawl and return the contents"
|
description: str = "Crawl webpages using Firecrawl and return the contents"
|
||||||
args_schema: Type[BaseModel] = FirecrawlCrawlWebsiteToolSchema
|
args_schema: Type[BaseModel] = FirecrawlCrawlWebsiteToolSchema
|
||||||
@@ -50,3 +55,14 @@ class FirecrawlCrawlWebsiteTool(BaseTool):
|
|||||||
|
|
||||||
options = {"crawlerOptions": crawler_options, "pageOptions": page_options}
|
options = {"crawlerOptions": crawler_options, "pageOptions": page_options}
|
||||||
return self.firecrawl.crawl_url(url, options)
|
return self.firecrawl.crawl_url(url, options)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from firecrawl import FirecrawlApp
|
||||||
|
# Must rebuild model after class is defined
|
||||||
|
FirecrawlCrawlWebsiteTool.model_rebuild()
|
||||||
|
except ImportError:
|
||||||
|
"""
|
||||||
|
When this tool is not used, then exception can be ignored.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user