caikit.runtime.service_generation.protoable =========================================== .. py:module:: caikit.runtime.service_generation.protoable .. autoapi-nested-parse:: This file contains our logic about what constitutes a proto-able for RPC generation purposes Attributes ---------- .. autoapisummary:: caikit.runtime.service_generation.protoable.log Functions --------- .. autoapisummary:: caikit.runtime.service_generation.protoable.to_protoable_signature caikit.runtime.service_generation.protoable.handle_protoables_in_union caikit.runtime.service_generation.protoable.get_union_list_type caikit.runtime.service_generation.protoable.get_protoable_return_type caikit.runtime.service_generation.protoable.is_protoable_type Module Contents --------------- .. py:data:: log .. py:function:: to_protoable_signature(signature: Dict[str, Type]) -> Dict[str, Type] Returns dictionary of protoable types only If there is a Union, pick the protoable type Args: signature (Dict[str, Type]): module signature of parameters and types .. py:function:: handle_protoables_in_union(field_name: str, arg_type: Type) -> Type Handles various protoable arg types from a Union. If arg_type is a union, then this will return the union back if all types in it are proto-able, or the first proto-able arg type if the union has non-protoable arg types. If arg_type is not a union nor protoable at all, this returns None. Examples: Union[protoable_type, non_protoable_type] -> protoable_type Union[protoable_type_1, protoable_type_2] -> Union[protoable_type_1, protoable_type_2] Union[protoable_type_1, protoable_type_2, non_protoable_type] -> protoable_type_1 .. py:function:: get_union_list_type(field_name: str, union_protoables: List) -> Type[caikit.core.data_model.base.DataBase] Create a union from list type objects .. py:function:: get_protoable_return_type(arg_type: Type) -> Type Helper function that determines the right data model type to use from a Union .. py:function:: is_protoable_type(arg_type: Type) -> bool Returns True if arg_type is in PROTO_TYPE_MAP(float, int, bool, str, bytes) Or if it's an imported Caikit data model class. Or if it's a Union of at least one of those. Or if it's a List of one of those. Or if it's a Dict of one of those. False otherwise