code: def run_rai_insights(
      model,
      train_data,
      test_data,
      target_column,
      task_type,
      feature_metadata=None,
      text_column=None,
  ):
      if task_type == ModelTask.TEXT_CLASSIFICATION:
          classes = train_data[target_column].unique()
          classes.sort()
      else:
          classes = None
      rai_insights = RAITextInsights(
          model,
          test_data,
          target_column,
          task_type=task_type,
          classes=classes,
          feature_metadata=feature_metadata,
          text_column=text_column,
      )
      rai_insights.explainer.add()
      if task_type != ModelTask.QUESTION_ANSWERING:
          rai_insights.error_analysis.add()
      rai_insights.compute()
      rai_insights.get_data()
      # Validate
      validate_rai_text_insights(
          rai_insights, classes, test_data, target_column, task_type
      )
  
file_path: responsible-ai-toolbox/responsibleai_text/tests/test_rai_text_insights.py
imports: from common_text_utils import ANSWERS, BLBOOKS_LABEL, COVID19_EVENTS_LABELS, DBPEDIA_LABEL, EMOTION, create_blbooks_pipeline, create_dbpedia_pipeline, create_multilabel_pipeline, create_question_answering_pipeline, create_text_classification_pipeline, load_blbooks_genre_dataset, load_covid19_emergency_event_dataset, load_dbpedia_dataset, load_emotion_dataset, load_squad_dataset
  from rai_text_insights_validator import validate_rai_text_insights
  from responsibleai.feature_metadata import FeatureMetadata
  from responsibleai_text import ModelTask, RAITextInsights
label_desc: Use image node_id 1 for calling a global function with example usage: run_rai_insights(model, train_data, test_data, target_column, task_type, feature_metadata, text_column) without return types