code: def add_build_knn_index_args(params):
      params.add_argument(
          "-i",
          "--input-dir",
          required=True,
          type=str,
          help="The directory that contains the stored decoder states and values "
          f"({C.KNN_STATE_DATA_STORE_NAME} and {C.KNN_WORD_DATA_STORE_NAME}).",
      )
      params.add_argument(
          "-o",
          "--output-dir",
          default=None,
          type=str,
          help="The path to the output directory. Will reuse input directory if not specified.",
      )
      params.add_argument(
          "-t",
          "--index-type",
          default=None,
          type=str,
          help="An optional field to specify the type of the index. "
          "Will override settings in the config. "
          "The type is specified with a faiss index factory signature, see here: "
          "https://github.com/facebookresearch/faiss/wiki/The-index-factory",
      )
      params.add_argument(
          "--train-data-input-file",
          default=None,
          type=str,
          help="An optional field to reuse an already-built training data sample for the index. "
          "Otherwise, a (slow) sampling step might need to be run.",
      )
      params.add_argument(
          "--train-data-size",
          default=None,
          type=int,
          help="An optional field to specify the size of the training sample. "
          "Will override settings in the config.",
      )
  
imports: import argparse
  import os
  import sys
  import types
  from typing import Any, Callable, Dict, List, Tuple, Optional
  import yaml
  from sockeye.utils import smart_open
  from .None import constants
label_desc: Use image node_id 43 for calling a global function with example usage: add_build_knn_index_args(params) without return types