code: def _set_generation_max_new_tokens(config: "ModelConfig") -> None:
      """Sets the max_new_tokens parameter in the generation config to the max sequence length of the output
      features.
  
      This ensures that the generation config is set to the correct value for the LLM model type.
      """
      _DEFAULT_MAX_SEQUENCE_LENGTH = (
          LLMGenerationConfig().max_new_tokens
      )
      if (
          config.generation.max_new_tokens
          != _DEFAULT_MAX_SEQUENCE_LENGTH
      ):
          # Max new tokens is explicitly set by user, so don't override
          return
  
      if config.output_features[0].type != TEXT:
          # This is trickier to set for other output features, so don't override for now.
          # TODO: Add better support for category output features
          return
  
      max_possible_sequence_length = (
          _get_maximum_possible_sequence_length(
              config, _DEFAULT_MAX_SEQUENCE_LENGTH
          )
      )
  
      logger.info(
          f"Setting generation max_new_tokens to {max_possible_sequence_length} to correspond with the max "
          "sequence length assigned to the output feature or the global max sequence length. This will ensure that "
          "the correct number of tokens are generated at inference time. To override this behavior, set "
          "`generation.max_new_tokens` to a different value in your Ludwig config."
      )
      config.generation.max_new_tokens = max_possible_sequence_length
  
imports: import copy
  import logging
  import sys
  import warnings
  from typing import Any, Dict, List, Mapping, Set, TYPE_CHECKING
  from marshmallow import ValidationError
  from transformers import AutoConfig
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import CATEGORY, COMBINED, DECODER, DEFAULTS, ENCODER, GRID_SEARCH, INPUT_FEATURES, LOSS, MODEL_ECD, MODEL_LLM, OUTPUT_FEATURES, PARAMETERS, PREPROCESSING, SEQUENCE, SPACE, TEXT, TYPE
  from ludwig.features.feature_utils import compute_feature_hash
  from ludwig.schema.features.utils import output_config_registry
  from ludwig.schema.hyperopt.scheduler import BaseHyperbandSchedulerConfig
  from ludwig.schema.llms.generation import LLMGenerationConfig
  from ludwig.schema.trainer import ECDTrainerConfig
  from ludwig.types import HyperoptConfigDict, ModelConfigDict
  from ludwig.utils.data_utils import get_sanitized_feature_name
  from ludwig.utils.llm_utils import get_context_len
label_desc: Use image node_id 15 for calling a global function with example usage: _set_generation_max_new_tokens(config) without return types