Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Nick: fixed extract schema
Nicolasc822e34d37fb
diff --git a/apps/python-sdk/firecrawl/__init__.py b/apps/python-sdk/firecrawl/__init__.pyindex 352305a4d..c860967a7 100644--- a/apps/python-sdk/firecrawl/__init__.py+++ b/apps/python-sdk/firecrawl/__init__.py@@ -13,7 +13,7 @@ import osfrom .firecrawl import FirecrawlApp # noqa-__version__ = "1.7.0"+__version__ = "1.7.1"# Define the logger for the Firecrawl projectlogger: logging.Logger = logging.getLogger("firecrawl")diff --git a/apps/python-sdk/firecrawl/firecrawl.py b/apps/python-sdk/firecrawl/firecrawl.pyindex 0181db90e..33d43b99a 100644--- a/apps/python-sdk/firecrawl/firecrawl.py+++ b/apps/python-sdk/firecrawl/firecrawl.py@@ -472,20 +472,24 @@ class FirecrawlApp:if not params or not params.get('prompt'):raise ValueError("Prompt is required")- if not params.get('schema'):- raise ValueError("Schema is required for extraction")+ schema = params.get('schema')+ if schema:+ if hasattr(schema, 'model_json_schema'):+ # Convert Pydantic model to JSON schema+ schema = schema.model_json_schema()+ # Otherwise assume it's already a JSON schema dictjsonData = {'urls': urls, **params}- jsonSchema = params['schema'].schema() if hasattr(params['schema'], 'schema') else None+ request_data = {+ **jsonData,+ 'allowExternalLinks': params.get('allow_external_links', False),+ 'schema': schema+ }try:response = self._post_request(f'{self.api_url}/v1/extract',- {- **jsonData,- 'allowExternalLinks': params.get('allow_external_links', False),- 'schema': jsonSchema- },+ request_data,headers)if response.status_code == 200: