code: def build_parameter_type_spec(
      value: Union[types.Property, data_types.RuntimeParameter]
  ) -> pipeline_pb2.ComponentInputsSpec.ParameterSpec:
      """Extracts the artifact type info into ComponentInputsSpec.ParameterSpec."""
      is_runtime_param = isinstance(value, data_types.RuntimeParameter)
      result = pipeline_pb2.ComponentInputsSpec.ParameterSpec()
      if isinstance(value, int) or (
          is_runtime_param and value.ptype == int
      ):
          result.type = pipeline_pb2.PrimitiveType.PrimitiveTypeEnum.INT
      elif isinstance(value, float) or (
          is_runtime_param and value.ptype == float
      ):
          result.type = (
              pipeline_pb2.PrimitiveType.PrimitiveTypeEnum.DOUBLE
          )
      elif isinstance(value, str) or (
          is_runtime_param and value.ptype == str
      ):
          result.type = (
              pipeline_pb2.PrimitiveType.PrimitiveTypeEnum.STRING
          )
      else:
          # By default, unrecognized object will be json dumped, hence is string type.
          # For example, resolver class.
          result.type = (
              pipeline_pb2.PrimitiveType.PrimitiveTypeEnum.STRING
          )
      return result
  
imports: import itertools
  import json
  import os
  import re
  from typing import Any, Dict, List, Mapping, Optional, Type, Union
  from kfp.pipeline_spec import pipeline_spec_pb2
  from tfx import types
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types
  from tfx.orchestration.kubeflow.v2 import parameter_utils
  from tfx.proto.orchestration import placeholder_pb2
  from tfx.types import artifact
  from tfx.types import channel
  from tfx.types import standard_artifacts
  from tfx.types.experimental import simple_artifacts
  from tfx.utils import json_utils
  from tfx.utils import name_utils
  import yaml
  from google.protobuf import struct_pb2
  from google.protobuf import json_format
  from google.protobuf import message
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: build_parameter_type_spec(value) and returns: result