class_docstr: Generate bot utterances by using a remote endpoint for the generation.
  
  The generator will call the endpoint for each message it wants to
  generate. The endpoint needs to respond with a properly formatted
  json. The generator will use this message to create a response for
  the bot.
class_docstr_tok: ["Generate","bot","utterances","by","using","a","remote","endpoint","for","the","generation",".","The","generator","will","call","the","endpoint","for","each","message","it","wants","to","generate",".","The","endpoint","needs","to","respond","with","a","properly","formatted","json",".","The","generator","will","use","this","message","to","create","a","response","for","the","bot","."]
docstr: Validate the NLG response. Raises exception on failure.
docstr_tok: ["Validate","the","NLG","response",".","Raises","exception","on","failure","."]
code: def validate_response(content: Optional[Dict[Text, Any]]) -> bool:
      """Validate the NLG response. Raises exception on failure."""
      from jsonschema import validate
      from jsonschema import ValidationError
  
      try:
          if content is None or content == "":
              # means the endpoint did not want to respond with anything
              return True
          else:
              validate(content, nlg_response_format_spec())
              return True
      except ValidationError as e:
          raise RasaException(
              f"{e.message}. Failed to validate NLG response from API, make sure "
              f"your response from the NLG endpoint is valid. "
              f"For more information about the format please consult the "
              f"`nlg_response_format_spec` function from this same module: "
              f"https://github.com/RasaHQ/rasa/blob/main/rasa/core/nlg/callback.py"
          )
  
file_path: rasa/rasa/core/nlg/callback.py
imports: import json
  import logging
  from typing import List, Text, Any, Dict, Optional
  from rasa.core.constants import DEFAULT_REQUEST_TIMEOUT
  from rasa.core.nlg.generator import NaturalLanguageGenerator, ResponseVariationFilter
  from rasa.shared.core.trackers import DialogueStateTracker, EventVerbosity
  from rasa.shared.exceptions import RasaException
  from rasa.utils.endpoints import EndpointConfig
label_desc: Use image node_id 2 for calling the CallbackNaturalLanguageGenerator obj's underlying member method code with example usage: obj.validate_response(content) and returns: True, True