FirecrawlF
Firecrawl5mo ago
2 replies
nationalmyth

invalid JSON schema with python client

I have been unable to send a request with a prompt and schema. I get OK results when I write a simplified schema within the prompt, however passing the class itself would be ideal per the documentation.

Code is as follows:
class SecondaryAsset(BaseModel):
    """
    Model for a secondary asset.
    """

    name: str
    url: str
    start_time: Optional[datetime | str]
    end_time: Optional[datetime | str]
    location: Optional[str] = None
    short_description: str = None
    long_description: str

app.extract(
            [source.source_url],
            prompt=selected_prompt, # stored in prompts.py
            schema=SecondaryAsset.model_json_schema(),
        )


The error I get:
Firecrawl extraction failed: Bad Request: Failed to extract. Bad Request - [{'code': 'custom', 'message': 'Invalid JSON schema.', 'path': ['schema']}]
Was this page helpful?