code: def _add_model_flags(
      parser: argparse.ArgumentParser,
  ) -> None:
      """Adds flags that are related to model selection and config."""
      flag_def.EnumFlagDef(
          name="model_type",
          short_name="mt",
          enum_type=model_registry.ModelName,
          default_value=model_registry.ModelRegistry.DEFAULT_MODEL,
          help_msg="The type of model to use.",
      ).add_argument_to_parser(parser)
  
      def _check_is_greater_than_or_equal_to_zero(x: float) -> float:
          if x < 0:
              raise ValueError(
                  "Value should be greater than or equal to zero, got {}".format(
                      x
                  )
              )
          return x
  
      flag_def.SingleValueFlagDef(
          name="temperature",
          short_name="t",
          parse_type=float,
          # Use None for default value to indicate that this will use the default
          # value in Text service.
          default_value=None,
          parse_to_dest_type_fn=_check_is_greater_than_or_equal_to_zero,
          help_msg=(
              "Controls the randomness of the output. Must be positive. Typical"
              " values are in the range: [0.0, 1.0]. Higher values produce a more"
              " random and varied response. A temperature of zero will be"
              " deterministic."
          ),
      ).add_argument_to_parser(parser)
  
      flag_def.SingleValueFlagDef(
          name="model",
          short_name="m",
          default_value=None,
          help_msg=(
              "The name of the model to use. If not provided, a default model will"
              " be used."
          ),
      ).add_argument_to_parser(parser)
  
      def _check_candidate_count_range(x: Any) -> int:
          if x < _MIN_CANDIDATE_COUNT or x > _MAX_CANDIDATE_COUNT:
              raise ValueError(
                  "Value should be in the range [{}, {}], got {}".format(
                      _MIN_CANDIDATE_COUNT, _MAX_CANDIDATE_COUNT, x
                  )
              )
          return int(x)
  
      flag_def.SingleValueFlagDef(
          name="candidate_count",
          short_name="cc",
          parse_type=int,
          # Use None for default value to indicate that this will use the default
          # value in Text service.
          default_value=None,
          parse_to_dest_type_fn=_check_candidate_count_range,
          help_msg="The number of candidates to produce.",
      ).add_argument_to_parser(parser)
  
      flag_def.BooleanFlagDef(
          name="unique",
          help_msg="Whether to dedupe candidates returned by the model.",
      ).add_argument_to_parser(parser)
  
imports: from __future__ import annotations
  import argparse
  import shlex
  import sys
  from typing import AbstractSet, Any, Callable, MutableMapping, Sequence
  from google.generativeai.notebook import argument_parser
  from google.generativeai.notebook import flag_def
  from google.generativeai.notebook import input_utils
  from google.generativeai.notebook import model_registry
  from google.generativeai.notebook import output_utils
  from google.generativeai.notebook import parsed_args_lib
  from google.generativeai.notebook import post_process_utils
  from google.generativeai.notebook import py_utils
  from google.generativeai.notebook import sheets_utils
  from google.generativeai.notebook.lib import llm_function
  from google.generativeai.notebook.lib import llmfn_inputs_source
  from google.generativeai.notebook.lib import llmfn_outputs
  from google.generativeai.notebook.lib import model
label_desc: Use image node_id 7 for calling a global function with example usage: _add_model_flags(parser) and returns: x, int