Create a lite LLM config adapter for crawl4ai.
The adapter provides: - legacy kwargs for crawl4ai <0.5 - llm_config kwargs + strategy kwargs for crawl4ai >=0.5
Source code in autogen/interop/litellm/litellm_config_factory.py
| @classmethod
def create_lite_llm_config(cls, llm_config: LLMConfig | dict[str, Any]) -> LiteLLmConfigAdapter:
"""Create a lite LLM config adapter for crawl4ai.
The adapter provides:
- legacy kwargs for crawl4ai <0.5
- llm_config kwargs + strategy kwargs for crawl4ai >=0.5
"""
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)
return cls._create_adapter(base_config)
raise ValueError("Could not find a factory for the given config.")
|