caikit.runtime.utils.import_util ================================ .. py:module:: caikit.runtime.utils.import_util .. autoapi-nested-parse:: A generic module to help import dynamic modules Attributes ---------- .. autoapisummary:: caikit.runtime.utils.import_util.log Classes ------- .. autoapisummary:: caikit.runtime.utils.import_util.UnifiedDataModel Functions --------- .. autoapisummary:: caikit.runtime.utils.import_util.get_data_model caikit.runtime.utils.import_util._get_cdm_from_lib caikit.runtime.utils.import_util.get_dynamic_module caikit.runtime.utils.import_util.clean_lib_names Module Contents --------------- .. py:data:: log .. py:class:: UnifiedDataModel This class acts as an aggregator between the data models of multiple Caikit libraries. .. py:attribute:: _libraries .. py:method:: add_library(lib_name: str, lib: types.ModuleType) Add the given library to the unified data model .. py:method:: __getattr__(name: str) -> Any Fetch an attribute by name aliasing into child libraries .. py:function:: get_data_model(config: aconfig.Config = None) -> UnifiedDataModel Get the data model from the Caikit library of interest. This is accomplished via dynamic import on the caikit_library's environment variable. NOTE: This function also has the side-effect of importing each of the caikit_library libraries for the first time, causing their modules to be registered with the caikit.core module registry. It is a critical step in initializing the set of modules that can be loaded by this running server instance. Args: config(aconfig.Config): caikit configuration Returns: (module): Handle to the module after dynamic wild import .. py:function:: _get_cdm_from_lib(lib_name: str, cdm: UnifiedDataModel) Function to get caikit core CDM from library name Args: lib_name (str): Caikit core library name cdm (UnifiedDataModel): Caikit core CDM Returns: cdm: UnifiedDataModel .. py:function:: get_dynamic_module(module_name: str, module_dir: str = None) -> types.ModuleType Get the dynamic module of interest. Args: module_name(str): Name of the module to be dynamically imported (Optional) module_dir(str): Name of the directory from where the module is to be dynamically imported Returns: (module): Handle to the module after dynamic import .. py:function:: clean_lib_names(caikit_library: str) -> List[str]