[Python] How to use LLMConfig in crawl4ai?

Discussão em 'Python' iniciado por Stack, Março 16, 2025.

  1. Stack

    Stack Membro Participativo

    So I was testing https://leonardo467.gumroad.com/l/cstsu this code that uses crawl4ai, but it seems that the library has been updated or something because if you run it (with an API, so I use free groq) it says "use LLMconfig instead".

    Alright. But now I have no idea how to fix THIS, because LLMconfig barely has documentation

    llm_strategy = LLMExtractionStrategy(
    llm_config=LLMConfig(provider="grok/grok-chat"),
    api_token=os.getenv(API_KEY),
    schema=Product.model_json_schema(),
    extraction_type="schema",
    instruction=INSTRUCTION_TO_LLM,
    chunk_token_threshold=1000,
    overlap_rate=0.0,
    apply_chunking=True,
    input_format="markdown",
    extra_args={"temperature": 0.0, "max_tokens": 800},
    )


    "litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call.
    You passed model=grok/grok-chat\n Pass model as E.g. For 'Huggingface' inference endpoints pass in
    completion(model='huggingface/starcoder',..) Learn more: https://docs.litellm.ai/docs/providers"


    I've checked the site. I may be blind or stupid, but I dont see how litellm and LLMConfig are connected and, more importantly, how to fix this mistake.

    Continue reading...

Compartilhe esta Página