crawl4ai中LLMConfig配置报错求助:使用Groq API时提示未提供LLM Provider
crawl4ai中LLMConfig配置报错求助:使用Groq API时提示未提供LLM Provider
最近我在测试一段基于crawl4ai的代码,结果遇到了库版本更新的问题——原来的代码现在直接提示要改用LLMConfig,可这个配置类的相关文档实在太少了,完全摸不着头绪!
我现在写的代码是这样的:
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"
我特意去查了相关文档,但可能是我太粗心或者文档藏得太深,完全没搞懂litellm和LLMConfig之间的关联,更不知道怎么修复这个错误。
最后没办法,我直接把crawl4ai降级到5.0版本之前的旧版本,代码居然就能正常运行了,但还是想搞清楚新版本里到底该怎么正确配置LLMConfig来适配Groq API。
备注:内容来源于stack exchange,提问作者ray
相关产品推荐
相关产品推荐

