docstr: Formats actions based on prompt_template 
  
  Args:
      prompt_template: determines whether acts, slot-names, slot-values are necessary in formatted actions
      actions: list of actions, each a dict containing keys 'act', 'slot' and 'values' with their corresponding values as their attribute-values
  
  Returns:
      formatted_actions: string representations of actions, formatted based on the fields needed.
docstr_tok: ["Formats","actions","based","on","prompt_template","Args",":","prompt_template",":","determines","whether","acts",",","slot-names",",","slot-values","are","necessary","in","formatted","actions","actions",":","list","of","actions",",","each","a","dict","containing","keys","'act","'",",","'slot","'","and","'values","'","with","their","corresponding","values","as","their","attribute-values","Returns",":","formatted_actions",":","string","representations","of","actions",",","formatted","based","on","the","fields","needed","."]
code: def format_actions(prompt_template, actions):
      """
      Formats actions based on prompt_template
  
      Args:
          prompt_template: determines whether acts, slot-names, slot-values are necessary in formatted actions
          actions: list of actions, each a dict containing keys 'act', 'slot' and 'values' with their corresponding values as their attribute-values
  
      Returns:
          formatted_actions: string representations of actions, formatted based on the fields needed.
      """
      actions_str = []
      for action in actions:
          act = action["act"].lower()
          slot = action["slot"]
          value = action["values"][0] if action["values"] else ""
  
          if prompt_template == "values":
              action_str = value
          elif prompt_template == "slots_values":
              if value:
                  action_str = "{} ({})".format(slot, value)
              else:
                  action_str = slot
          elif prompt_template == "acts_slots_values":
              if value:
                  action_str = "{} {} ({})".format(act, slot, value)
              elif slot:
                  action_str = "{} {}".format(act, slot)
              else:
                  action_str = act
          else:
              raise ValueError(
                  "Please set model.dataset.prompt_template to acts_slots_values, slots_values or values"
              )
          actions_str.append(action_str)
      return " ".join(actions_str)
  
file_path: NeMo/nemo/collections/nlp/data/dialogue/dataset/dialogue_s2s_generation_dataset.py
imports: import torch
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_dataset import DialogueDataset
label_desc: Use image node_id 2 for calling the DialogueS2SGenerationDataset obj's underlying member method code with example usage: obj.format_actions(prompt_template, actions) and returns: str