aiagent.Factory¶
- class Factory¶
Registered factory_methods create instances by string name.
Each instance of Factory is designed to create instances of objects that typically inherit from a common base class. A factory can have as many factory_method instances registered with it as needed. Client code can create instances of an object with a string name which it typically gets from a configuration option. This is good way to swap out implementations of a concrete class based on deployment and environmental factors. For example, use a RabbitMQ queue or an AWS SQS queue.
- __init__()¶
Methods
__init__
()create
(name, **factory_args)Create an instance of the Factory's base type with args provided.
register
(name, factory_method)Register a factory_method with a name.