Create a lite LLM config compatible with the installed crawl4ai version.
For crawl4ai >=0.5: Returns config with llmConfig parameter For crawl4ai <0.5: Returns config with provider parameter (legacy)
Source code in autogen/interop/litellm/litellm_config_factory.py
| @classmethod
def create_lite_llm_config(cls, llm_config: Union[LLMConfig, dict[str, Any]]) -> dict[str, Any]:
"""
Create a lite LLM config compatible with the installed crawl4ai version.
For crawl4ai >=0.5: Returns config with llmConfig parameter
For crawl4ai <0.5: Returns config with provider parameter (legacy)
"""
first_llm_config = get_first_llm_config(llm_config)
for factory in LiteLLmConfigFactory._factories:
if factory.accepts(first_llm_config):
base_config = factory.create(first_llm_config)
# Check crawl4ai version and adapt config accordingly
if is_crawl4ai_v05_or_higher():
return cls._adapt_for_crawl4ai_v05(base_config)
else:
return base_config # Use legacy format
raise ValueError("Could not find a factory for the given config.")
|