caikit.core.registries

Single spot for all global shared state access

This should not import anything else from caikit outside the toolkit error handler, many parts of caikit need to access this state so that would easily cause an import cycle.

Attributes

log

error

MODULE_REGISTRY

MODULE_BACKEND_REGISTRY

MODULE_BACKEND_TYPES

MODULE_BACKEND_CLASSES

Classes

_AttrAccessBackendDict

Simple extension on a dict that allows attribute access in addition to

Functions

module_registry(→ Dict[str, caikit.core.ModuleBase])

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you're doing!

module_backend_registry(→ Dict[str, Dict[str, ...)

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you're doing!

module_backend_types(→ Dict[str, str])

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you're doing!

module_backend_classes(→ Dict[str, ...)

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you're doing!

Module Contents

caikit.core.registries.log[source]
caikit.core.registries.error
caikit.core.registries.MODULE_REGISTRY
caikit.core.registries.MODULE_BACKEND_REGISTRY
caikit.core.registries.module_registry() Dict[str, caikit.core.ModuleBase][source]

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you’re doing!

Returns the dictionary of decorated @modules that have been imported. Used to map module IDs to the concrete class implementations to load and run.

Structure is Dict[ module_id, module_class ]

Returns:

Dict[str, caikit.core.ModuleBase]: The module registry

caikit.core.registries.module_backend_registry() Dict[str, Dict[str, Tuple[caikit.core.ModuleBase, Dict]]][source]

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you’re doing!

Returns the module backend registry. This adds more nesting to the module registry, providing a dictionary of backend type name -> (backend module impl class, config dict)

Structure is Dict[ module_id, Dict[ backend_type, Tuple[ backend_impl_class, backend_config_dict ] ] ]

Returns:
Dict[str, Dict[str, Tuple[“caikit.core.ModuleBase”, Dict]]]: The module

backend registry

class caikit.core.registries._AttrAccessBackendDict[source]

Bases: dict

Simple extension on a dict that allows attribute access in addition to index lookup

__getattr__(name: str) Any[source]

Alias to index lookup

caikit.core.registries.MODULE_BACKEND_TYPES
caikit.core.registries.module_backend_types() Dict[str, str][source]

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you’re doing!

Returns the “enum” of module backend types. This is a dict where the keys and values are identical, and each are the string names of a backend type.

Returns:
Dict[str, str]:

The module backend type enum

caikit.core.registries.MODULE_BACKEND_CLASSES: Dict[str, Type[caikit.core.BackendBase]]
caikit.core.registries.module_backend_classes() Dict[str, Type[caikit.core.BackendBase]][source]

🌶️🌶️🌶️ This returns global state that should only be mutated if you know what you’re doing!

Returns the mapping of backend type name to concrete backend class

Returns:
Dict[str, Type[“caikit.core.BackendBase”]]:

The module backend class registry