code: def create_gen_function(host="localhost", port=5555):
      def request(
          prompts,
          greedy,
          add_BOS,
          token_to_gen,
          min_tokens,
          temp,
          top_p,
          top_k,
          repetition,
          end_strings,
      ):
          data = {
              "sentences": prompts,
              "tokens_to_generate": int(token_to_gen),
              "temperature": temp,
              "add_BOS": add_BOS,
              "top_k": top_k,
              "top_p": top_p,
              "greedy": greedy,
              "all_probs": False,
              "repetition_penalty": repetition,
              "min_tokens_to_generate": int(min_tokens),
              "end_strings": end_strings,
          }
          response = text_generation(data, ip=host, port=port)
          sentences = response["sentences"]
          return sentences
  
      return request
  
file_path: NeMo/scripts/nlp_language_modeling/sft/attribute_annotate.py
imports: import json
  import os
  import fire
  import tqdm
  from langchain.prompts.few_shot import PromptTemplate
  from nemo.collections.nlp.modules.common.megatron.retrieval_services.util import text_generation
label_desc: Use image node_id 4 for calling a global function with example usage: create_gen_function(host, port) and returns: request, sentences