{"record":{"id":"dccda96facfb73a9","repo":"unclecode/crawl4ai","slug":"setting-name-is-deprecated-message-dccda9","errorCode":null,"errorMessage":"Setting '{name}' is deprecated. {message}","messagePattern":"Setting '(.+?)' is deprecated\\. (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"warning","filePath":"crawl4ai/extraction_strategy.py:1818","lineNumber":4652,"sourceCode":"        Generate extraction schema from HTML content and optional query.\n        \n        Args:\n            html (str): The HTML content to analyze\n            query (str, optional): Natural language description of what data to extract\n            provider (str): Legacy Parameter. LLM provider to use \n            api_token (str): Legacy Parameter. API token for LLM provider\n            llm_config (LLMConfig): LLM configuration object\n            prompt (str, optional): Custom prompt template to use\n            **kwargs: Additional args passed to LLM processor\n            \n        Returns:\n            dict: Generated schema following the JsonElementExtractionStrategy format\n        \"\"\"\n        from .prompts import JSON_SCHEMA_BUILDER\n        from .utils import perform_completion_with_backoff\n        for name, message in JsonElementExtractionStrategy._GENERATE_SCHEMA_UNWANTED_PROPS.items():\n            if locals()[name] is not None:\n                raise AttributeError(f\"Setting '{name}' is deprecated. {message}\")\n        \n        # Use default or custom prompt\n        prompt_template = JSON_SCHEMA_BUILDER if schema_type == \"CSS\" else JSON_SCHEMA_BUILDER_XPATH\n        \n        # Build the prompt\n        system_message = {\n            \"role\": \"system\", \n            \"content\": f\"\"\"You specialize in generating special JSON schemas for web scraping. This schema uses CSS or XPATH selectors to present a repetitive pattern in crawled HTML, such as a product in a product list or a search result item in a list of search results. We use this JSON schema to pass to a language model along with the HTML content to extract structured data from the HTML. The language model uses the JSON schema to extract data from the HTML and retrieve values for fields in the JSON schema, following the schema.\n\nGenerating this HTML manually is not feasible, so you need to generate the JSON schema using the HTML content. The HTML copied from the crawled website is provided below, which we believe contains the repetitive pattern.\n\n# Schema main keys:\n- name: This is the name of the schema.\n- baseSelector: This is the CSS or XPATH selector that identifies the base element that contains all the repetitive patterns.\n- baseFields: This is a list of fields that you extract from the base element itself.\n- fields: This is a list of fields that you extract from the children of the base element. {{name, selector, type}} based on the type, you may have extra keys such as \"attribute\" when the type is \"attribute\".\n\n# Extra Context:","sourceCodeStart":4634,"sourceCodeEnd":4670,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/deploy/docker/c4ai-code-context.md#L4634-L4670","documentation":"JsonElementExtractionStrategy.generate_schema() used to accept individual parameters (provider, api_token, base_url, extract_type and similar legacy kwargs). These were consolidated into an LLMConfig object, and the method now inspects locals() against _GENERATE_SCHEMA_UNWANTED_PROPS and raises AttributeError if any legacy parameter is passed with a non-None value. The message includes the offending parameter name and a migration hint.","triggerScenarios":"Calling JsonElementExtractionStrategy.generate_schema(html=..., provider=\"openai/gpt-4o\", api_token=\"sk-...\") or passing extract_type/base_url as standalone kwargs instead of an llm_config=LLMConfig(...) object.","commonSituations":"Upgrading crawl4ai from an older version where generate_schema took flat LLM parameters; copy-pasted examples or tutorials targeting the old signature; wrappers that forward **kwargs into generate_schema.","solutions":["Build an LLMConfig(provider=..., api_token=..., base_url=...) and pass it via the llm_config parameter instead of the flat kwargs","Remove any of the deprecated kwargs (provider, api_token, base_url, extract_type) from your call; only prompt, schema_type, html and llm_config remain supported","Check the installed version's _GENERATE_SCHEMA_UNWANTED_PROPS dict for the exact deprecated names and their migration messages"],"exampleFix":"// before\nschema = await JsonElementExtractionStrategy.generate_schema(\n    html=html, provider=\"openai/gpt-4o\", api_token=token\n)\n// after\nfrom crawl4ai import LLMConfig\nschema = await JsonElementExtractionStrategy.generate_schema(\n    html=html, llm_config=LLMConfig(provider=\"openai/gpt-4o\", api_token=token)\n)","handlingStrategy":"validation","validationCode":"from crawl4ai import LLMConfig\n\nDEPRECATED_SCHEMA_KWARGS = {\"provider\", \"api_token\", \"base_url\", \"extract_type\"}\n\ndef build_schema_call_kwargs(prompt=None, schema_type=\"CSS\", **legacy):\n    bad = DEPRECATED_SCHEMA_KWARGS & legacy.keys()\n    if bad:\n        raise TypeError(f\"generate_schema no longer accepts: {bad}; wrap them in llm_config=\")\n    llm = LLMConfig(provider=legacy.get(\"_provider\"), api_token=legacy.get(\"_token\"))\n    return {\"prompt\": prompt, \"schema_type\": schema_type, \"llm_config\": llm}","typeGuard":null,"tryCatchPattern":"try:\n    schema = await JsonElementExtractionStrategy.generate_schema(html, llm_config=cfg)\nexcept AttributeError as e:\n    if \"deprecated\" in str(e):\n        # a legacy kwarg slipped through a wrapper; log and rebuild call with LLMConfig\n        raise\n    raise","preventionTips":["Audit all call sites of generate_schema for flat provider/api_token/base_url kwargs before upgrading crawl4ai","Centralize LLM credentials in one LLMConfig construction point so legacy kwargs never reach the API","Add a smoke test after upgrades that calls generate_schema with your production arguments"],"tags":["crawl4ai","deprecation","schema-generation","llm-config"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}