code: def build_requests(  # pylint: disable=invalid-name
      model_name: str,
      model: types.Artifact,
      examples: types.Artifact,
      request_spec: infra_validator_pb2.RequestSpec,
  ) -> List[iv_types.Request]:
      """Build model server requests.
  
      Examples artifact will be used as a data source to build requests. Caller
      should guarantee that the logical format of the Examples artifact should be
      compatible with request type to build.
  
      Args:
        model_name: A model name that model server recognizes.
        model: A model artifact for model signature analysis.
        examples: An `Examples` artifact for request data source.
        request_spec: A `RequestSpec` config.
  
      Returns:
        A list of request protos.
      """
      split_name = request_spec.split_name or None
      num_examples = request_spec.num_examples or _DEFAULT_NUM_EXAMPLES
  
      kind = request_spec.WhichOneof("kind")
      if kind == _TENSORFLOW_SERVING:
          spec = request_spec.tensorflow_serving
          signatures = _parse_saved_model_signatures(
              model_path=path_utils.serving_model_path(
                  model.uri, path_utils.is_old_model_artifact(model)
              ),
              tag_set=spec.tag_set,
              signature_names=spec.signature_names,
          )
          builder = _TFServingRpcRequestBuilder(
              model_name=model_name, signatures=signatures
          )
      else:
          raise NotImplementedError(
              "Unsupported RequestSpec kind {!r}".format(kind)
          )
  
      builder.ReadExamplesArtifact(
          examples, split_name=split_name, num_examples=num_examples
      )
  
      return builder.BuildRequests()
  
imports: import abc
  import os
  from typing import Any, Iterable, List, Mapping, Optional
  from absl import logging
  import tensorflow
  from tfx import types
  from tfx.components.infra_validator import types
  from tfx.components.util import examples_utils
  from tfx.components.util import tfxio_utils
  from tfx.dsl.io import fileio
  from tfx.proto import example_gen_pb2
  from tfx.proto import infra_validator_pb2
  from tfx.types import artifact_utils
  from tfx.utils import path_utils
  from tfx_bsl.tfxio import dataset_options
  from tensorflow.python.saved_model import loader_impl
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: build_requests(model_name, model, examples, request_spec) and returns: builder