caikit.runtime.names

! NOTE ! This file should not import any extra dependencies. It is intended for use by client libraries that do not necessarily use a specific runtime server type.

Attributes

log

LOCAL_MODEL_TYPE

DEFAULT_LOADER_NAME

DEFAULT_SIZER_NAME

TRAINING_MANAGEMENT_SERVICE_NAME

TRAINING_MANAGEMENT_SERVICE_PACKAGE

TRAINING_MANAGEMENT_SERVICE_SPEC

INFO_SERVICE_NAME

INFO_SERVICE_PACKAGE

INFO_SERVICE_SPEC

MODEL_MANAGEMENT_SERVICE_NAME

MODEL_MANAGEMENT_SERVICE_PACKAGE

MODEL_MANAGEMENT_SERVICE_SPEC

MODEL_MESH_MODEL_ID_KEY

HEALTH_ENDPOINT

INFO_ENDPOINT

RUNTIME_INFO_ENDPOINT

MODELS_INFO_ENDPOINT

MANAGEMENT_ENDPOINT

MODEL_MANAGEMENT_ENDPOINT

TRAINING_MANAGEMENT_ENDPOINT

REQUIRED_INPUTS_KEY

OPTIONAL_INPUTS_KEY

MODEL_ID

EXTRA_OPENAPI_KEY

ACK_HEADER_STRING

STATUS_CODE_TO_HTTP

HTTP_TO_STATUS_CODE

CAIKIT_STATUS_CODE_TO_GRPC

Classes

ServiceType

Common class for describing service types

StreamEventTypes

Create a collection of name/value pairs.

Functions

get_ai_domain(→ str)

Get the string name for the AI domain

get_service_package_name(→ str)

This helper will get the name of service package

get_service_name(→ str)

This helper will get the name of the service

get_train_rpc_name(→ str)

Helper function to convert from the name of a module to the name of the

get_task_predict_rpc_name(→ str)

Helper function to get the name of a task's RPC

get_task_predict_job_rpc_name(→ str)

Helper function to get the name of a task's start job RPC

get_task_predict_job_status_rpc_name(→ str)

Helper function to get the name of a task's job status RPC

get_task_predict_job_cancel_rpc_name(→ str)

Helper function to get the name of a task's job cancel RPC

get_task_predict_job_result_rpc_name(→ str)

Helper function to get the name of a task's job resul RPC

get_train_request_name(→ str)

Helper function to get the request name of a Train Service

get_train_parameter_name(→ str)

Helper function to get the inner request parameter name of a Train Service

get_task_predict_request_name(→ str)

Helper function to get the name of an RPC's request data type

get_http_route_name(→ str)

Function to get the http route for a given rpc name

get_http_prediction_job_route_name(→ str)

Function to get the http route for a prediction job given a rpc name

get_http_prediction_job_result_route_name(→ str)

Function to get the http route for a prediction job result given a rpc name

get_grpc_route_name(→ str)

Function to get GRPC name for a given service type and rpc name

Module Contents

caikit.runtime.names.log[source]
caikit.runtime.names.LOCAL_MODEL_TYPE = 'standalone-model'
caikit.runtime.names.DEFAULT_LOADER_NAME = 'default'
caikit.runtime.names.DEFAULT_SIZER_NAME = 'default'
class caikit.runtime.names.ServiceType(*args, **kwds)[source]

Bases: enum.Enum

Common class for describing service types

INFERENCE = 1
TRAINING = 2
TRAINING_MANAGEMENT = 3
INFO = 4
MODEL_MANAGEMENT = 5
JOB_INFERENCE = 6
caikit.runtime.names.get_ai_domain() str[source]

Get the string name for the AI domain

Returns:

domain(str): The domain for this service

caikit.runtime.names.get_service_package_name(service_type: ServiceType | None = None) str[source]

This helper will get the name of service package

Args:
service_type Optional[ServiceType]: The Service Type’s package name to fetch defaults

to runtime

Returns:

str: The name of the service package

caikit.runtime.names.get_service_name(service_type: ServiceType) str[source]

This helper will get the name of the service

Args:

service_type ServiceType: The Service Type whose name to fetch

Returns:

str: The name of the service

caikit.runtime.names.get_train_rpc_name(module_class: Type[caikit.core.modules.ModuleBase]) str[source]

Helper function to convert from the name of a module to the name of the request RPC function

caikit.runtime.names.get_task_predict_rpc_name(task_or_module_class: Type[caikit.core.modules.ModuleBase | caikit.core.task.TaskBase], input_streaming: bool = False, output_streaming: bool = False) str[source]

Helper function to get the name of a task’s RPC

caikit.runtime.names.get_task_predict_job_rpc_name(task_or_module_class: Type[caikit.core.modules.ModuleBase | caikit.core.task.TaskBase]) str[source]

Helper function to get the name of a task’s start job RPC

caikit.runtime.names.get_task_predict_job_status_rpc_name(task_or_module_class: Type[caikit.core.modules.ModuleBase | caikit.core.task.TaskBase]) str[source]

Helper function to get the name of a task’s job status RPC

caikit.runtime.names.get_task_predict_job_cancel_rpc_name(task_or_module_class: Type[caikit.core.modules.ModuleBase | caikit.core.task.TaskBase]) str[source]

Helper function to get the name of a task’s job cancel RPC

caikit.runtime.names.get_task_predict_job_result_rpc_name(task_or_module_class: Type[caikit.core.modules.ModuleBase | caikit.core.task.TaskBase]) str[source]

Helper function to get the name of a task’s job resul RPC

caikit.runtime.names.get_train_request_name(module_class: Type[caikit.core.modules.ModuleBase]) str[source]

Helper function to get the request name of a Train Service

caikit.runtime.names.get_train_parameter_name(module_class: Type[caikit.core.modules.ModuleBase]) str[source]

Helper function to get the inner request parameter name of a Train Service

caikit.runtime.names.get_task_predict_request_name(task_or_module_class: Type[caikit.core.modules.ModuleBase | caikit.core.task.TaskBase], input_streaming: bool = False, output_streaming: bool = False) str[source]

Helper function to get the name of an RPC’s request data type

caikit.runtime.names.TRAINING_MANAGEMENT_SERVICE_NAME = 'TrainingManagement'
caikit.runtime.names.TRAINING_MANAGEMENT_SERVICE_PACKAGE = 'caikit.runtime.training'
caikit.runtime.names.TRAINING_MANAGEMENT_SERVICE_SPEC
caikit.runtime.names.INFO_SERVICE_NAME = 'InfoService'
caikit.runtime.names.INFO_SERVICE_PACKAGE = 'caikit.runtime.info'
caikit.runtime.names.INFO_SERVICE_SPEC
caikit.runtime.names.MODEL_MANAGEMENT_SERVICE_NAME = 'ModelManagement'
caikit.runtime.names.MODEL_MANAGEMENT_SERVICE_PACKAGE = 'caikit.runtime.models'
caikit.runtime.names.MODEL_MANAGEMENT_SERVICE_SPEC
caikit.runtime.names.MODEL_MESH_MODEL_ID_KEY = 'mm-model-id'
caikit.runtime.names.HEALTH_ENDPOINT = '/health'
caikit.runtime.names.INFO_ENDPOINT = '/info'
caikit.runtime.names.RUNTIME_INFO_ENDPOINT = '/info/version'
caikit.runtime.names.MODELS_INFO_ENDPOINT = '/info/models'
caikit.runtime.names.MANAGEMENT_ENDPOINT = '/management'
caikit.runtime.names.MODEL_MANAGEMENT_ENDPOINT = '/management/models'
caikit.runtime.names.TRAINING_MANAGEMENT_ENDPOINT = '/management/trainings'
caikit.runtime.names.REQUIRED_INPUTS_KEY = 'inputs'
caikit.runtime.names.OPTIONAL_INPUTS_KEY = 'parameters'
caikit.runtime.names.MODEL_ID = 'model_id'
caikit.runtime.names.EXTRA_OPENAPI_KEY = 'extra_openapi'
caikit.runtime.names.ACK_HEADER_STRING = 'acknowledgement'
class caikit.runtime.names.StreamEventTypes(*args, **kwds)[source]

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

MESSAGE = 'message'
ERROR = 'error'
caikit.runtime.names.get_http_route_name(rpc_name: str) str[source]

Function to get the http route for a given rpc name

Args:

rpc_name (str): The name of the Caikit RPC

Raises:

NotImplementedError: If the RPC is not a Train or Predict RPC

Returns:

str: The name of the http route for RPC

caikit.runtime.names.get_http_prediction_job_route_name(rpc_name: str) str[source]

Function to get the http route for a prediction job given a rpc name

Args:

rpc_name (str): The name of the Caikit RPC

Raises:

NotImplementedError: If the RPC is not a Train or Predict RPC

Returns:

str: The name of the http route for RPC

caikit.runtime.names.get_http_prediction_job_result_route_name(rpc_name: str) str[source]

Function to get the http route for a prediction job result given a rpc name

Args:

rpc_name (str): The name of the Caikit RPC

Raises:

NotImplementedError: If the RPC is not a Train or Predict RPC

Returns:

str: The name of the http route for RPC

caikit.runtime.names.get_grpc_route_name(service_type: ServiceType, rpc_name: str) str[source]

Function to get GRPC name for a given service type and rpc name

Args:

rpc_name (str): The name of the Caikit RPC

Returns:

str: The name of the GRPC route for RPC

caikit.runtime.names.STATUS_CODE_TO_HTTP
caikit.runtime.names.HTTP_TO_STATUS_CODE
caikit.runtime.names.CAIKIT_STATUS_CODE_TO_GRPC