cognee/infrastructure/loaders/get_loader_engine.py
2025-07-13 20:24:52 +02:00

20 lines
606 B
Python

from functools import lru_cache
from .config import get_loader_config
from .LoaderEngine import LoaderEngine
from .create_loader_engine import create_loader_engine
@lru_cache
def get_loader_engine() -> LoaderEngine:
"""
Factory function to get loader engine.
Follows cognee's pattern with @lru_cache for efficient reuse
of engine instances. Configuration is loaded from environment
variables and settings.
Returns:
Cached LoaderEngine instance configured with current settings
"""
config = get_loader_config()
return create_loader_engine(**config.to_dict())