caikit.runtime.service_factory

This module is responsible for creating service objects for the runtime to consume

Attributes

log

error

Classes

ServicePackage

Container with references to:

ServicePackageFactory

Factory responsible for yielding the correct concrete ServicePackage implementation

Functions

get_inference_request(...)

Helper function to return the inference request DataModel for the Module or Task Class

get_train_request(...)

Helper function to return the train request DataModel for the Module Class

get_train_params(...)

Helper function to return the train parameters DataModel for the Module Class

Module Contents

caikit.runtime.service_factory.log[source]
caikit.runtime.service_factory.error
class caikit.runtime.service_factory.ServicePackage[source]

Container with references to: - A service Class - A service Descriptor - A grpc servicer registration function - A client stub - A client messages module

service: Type[google.protobuf.service.Service]
descriptor: google.protobuf.descriptor.ServiceDescriptor
registration_function: Callable[[google.protobuf.service.Service, grpc.Server], None]
stub_class: Type
messages: types.ModuleType
caikit_rpcs: Dict[str, caikit.runtime.service_generation.rpcs.CaikitRPCBase]
class caikit.runtime.service_factory.ServicePackageFactory[source]

Factory responsible for yielding the correct concrete ServicePackage implementation

ServiceType
classmethod get_service_package(service_type: ServiceType, write_modules_file: bool = False) ServicePackage[source]

Public factory API. Returns a service package of the requested type, from the configured source.

Args:
service_type (ServicePackageFactory.ServiceType): The type of service to build,

to match the servicer implementation that will handle it. e.g. the GlobalPredictServicer expects an “INFERENCE” service

write_modules_file (bool): if set, write out a modules.json file to list the

included modules in this service generation. See config to customize file name at runtime.service_generation.backwards_compatibility.current_modules_path

Returns:
ServicePackage: A container with properties referencing everything you need to bind a

concrete Servicer implementation to a protobufs Service and grpc Server

static _check_backwards_compatibility(caikit_config: aconfig.Config, clean_modules: Set[Type[caikit.core.ModuleBase]])[source]
static _get_and_filter_modules(caikit_config: aconfig.Config, lib: str, write_modules_file: bool) Set[Type[caikit.core.ModuleBase]][source]
caikit.runtime.service_factory.get_inference_request(task_or_module_class: Type[caikit.core.ModuleBase | caikit.core.task.TaskBase], input_streaming: bool = False, output_streaming: bool = False) Type[caikit.core.data_model.base.DataBase][source]

Helper function to return the inference request DataModel for the Module or Task Class

caikit.runtime.service_factory.get_train_request(module_class: Type[caikit.core.ModuleBase]) Type[caikit.core.data_model.base.DataBase][source]

Helper function to return the train request DataModel for the Module Class

caikit.runtime.service_factory.get_train_params(module_class: Type[caikit.core.ModuleBase]) Type[caikit.core.data_model.base.DataBase][source]

Helper function to return the train parameters DataModel for the Module Class