Skip to content

Class swarmauri_core.factories.IFactory.IFactory

swarmauri_core.factories.IFactory.IFactory

Bases: ABC

Interface defining core methods for factories.

create abstractmethod

create(type, *args, **kwargs)

Create and return an instance.

Source code in swarmauri_core/factories/IFactory.py
10
11
12
13
@abstractmethod
def create(self, type: str, *args: Any, **kwargs: Any) -> Any:
    """Create and return an instance."""
    pass

register abstractmethod

register(type, resource_class)

Register a class with the factory.

Source code in swarmauri_core/factories/IFactory.py
15
16
17
18
@abstractmethod
def register(self, type: str, resource_class: Callable) -> None:
    """Register a class with the factory."""
    pass