class_docstr: Combo Faiss Retrieval Flask resource.
  The PUT method is to get KNN tokens, add new chunks, reset index.
code: def put(self):
      data = request.get_json()
      if "neighbors" in data:
          sentences = data["sentences"]
          # do knn query
          num_neighbors = data["neighbors"]
          with (
              lock
          ):  # Need to get lock to keep multiple threads from hitting code
              neighbors = self.get_knn(sentences, num_neighbors)
          return jsonify(neighbors.tolist())
      elif "reset" in data:
          with (
              lock
          ):  # Need to get lock to keep multiple threads from hitting code
              self.reset()
          return "success"
      elif "update_weight" in data:
          with lock:
              self.update_weights(data["update_weight"])
          return "success"
      elif "index_name" in data:
          with lock:
              # serialize the index
              index = self.index
              if hasattr(faiss, "index_gpu_to_cpu"):
                  index = faiss.index_gpu_to_cpu(index)
              faiss.write_index(
                  index,
                  data["index_name"]
                  + "_"
                  + self.output_filename
                  + ".index",
              )
              # save the data
              with open(self.output_filename + ".pkl", "bw") as f:
                  pickle.dump(self.ds, f)
      else:
          sentences = data["sentences"]
          add_eos = data["add_eos"]
          # update the index
          with (
              lock
          ):  # Need to get lock to keep multiple threads from hitting code
              self.add_docs_to_index(sentences, add_eos)
          return "success"
  
imports: import pickle
  import threading
  from typing import List, Union
  import faiss
  import numpy
  import torch
  from flask import Flask, jsonify, request
  from flask_restful import Api, Resource
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.modules.common.megatron.retrieval_services.retrieval_service import DynamicFaissRetrievalService, FaissRetrievalService
  from nemo.collections.nlp.modules.common.megatron.retrieval_services.util import lock
label_desc: Use image node_id 2 for calling the ComboRetrievalResource obj's underlying member method code with example usage: obj.put() and returns: jsonify, str, str, str