class_docstr: (openai<1) A class for OpenAI completion API.
  
  It also supports: ChatCompletion, Azure OpenAI API.
code: def _update_invalid_n(
      cls, prune, region_key, max_tokens, num_completions
  ):
      if prune:
          # update invalid n and prune this config
          cls._min_invalid_n_per_max_tokens[
              region_key
          ] = invalid_n = cls._min_invalid_n_per_max_tokens.get(
              region_key, {}
          )
          invalid_n[max_tokens] = min(
              num_completions, invalid_n.get(max_tokens, np.inf)
          )
  
imports: from time import sleep
  import logging
  import time
  from typing import List, Optional, Dict, Callable, Union
  import sys
  import shutil
  import numpy
  from flaml import tune, BlendSearch
  from flaml.tune.space import is_constant
  from flaml.automl.logger import logger_formatter
  from .openai_utils import get_key
  from collections import defaultdict
label_desc: Use image node_id 8 for calling the Completion obj's underlying member method code with example usage: obj._update_invalid_n(cls, prune, region_key, max_tokens, num_completions) without return types