Repository: JohnSnowLabs/langtest (language: python)

Issue:
Add support for HF datasets for other tasks



Discussion / hints:

Fix patch:
diff --git a/demo/tutorials/misc/HuggingFace_Dataset_Notebook.ipynb b/demo/tutorials/misc/HuggingFace_Dataset_Notebook.ipynb
index afae5ad73..b13255f06 100644
--- a/demo/tutorials/misc/HuggingFace_Dataset_Notebook.ipynb
+++ b/demo/tutorials/misc/HuggingFace_Dataset_Notebook.ipynb
@@ -69,7 +69,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 2,
    "metadata": {
     "execution": {
      "iopub.execute_input": "2023-08-18T08:51:11.291083Z",
@@ -5556,6 +5556,981 @@
    "source": [
     "harness.report()"
    ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "# HuggingFace Datasets Testing For `Question Answering`\n",
+    "\n",
+    "In this section, we dive into testing of OpenAI models in Question Answering task.\n",
+    "\n",
+    "LangTest supports robustness tests for LLM testing for now."
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "For question-answering, it's crucial to be aware of the default attribute values:\n",
+    "\n",
+    "- `split` is set to \"test\" by default.\n",
+    "- `feature_column` is `{\"passage\": \"context\", \"question\": \"question\"}` by default.\n",
+    "- `target_column` is \"answer\" by default.\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import os\n",
+    "import openai\n",
+    "os.environ[\"OPENAI_API_KEY\"] = \"<YOUR_API_KEY>\""
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Setup and Configure Harness"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Test Configuration : \n",
+      " {\n",
+      " \"model_parameters\": {\n",
+      "  \"temperature\": 0.2,\n",
+      "  \"max_tokens\": 64\n",
+      " },\n",
+      " \"tests\": {\n",
+      "  \"defaults\": {\n",
+      "   \"min_pass_rate\": 1.0\n",
+      "  },\n",
+      "  \"robustness\": {\n",
+      "   \"add_typo\": {\n",
+      "    \"min_pass_rate\": 0.7\n",
+      "   },\n",
+      "   \"lowercase\": {\n",
+      "    \"min_pass_rate\": 0.7\n",
+      "   }\n",
+      "  }\n",
+      " }\n",
+      "}\n"
+     ]
+    }
+   ],
+   "source": [
+    "harness = Harness(task=\"question-answering\",\n",
+    "                  model={\"model\":\"text-davinci-003\",\"hub\":\"openai\"},\n",
+    "                  data={\"data_source\":'LangChainDatasets/sql-qa-chinook',\n",
+    "                  \"feature_column\":{\"question\": \"question\"},\n",
+    "                  \"target_column\":\"answer\",\n",
+    "                  \"split\":\"train\",\n",
+    "                  \"source\": \"huggingface\"\n",
+    "                  })"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'tests': {'defaults': {'min_pass_rate': 0.5},\n",
+       "  'robustness': {'add_typo': {'min_pass_rate': 0.7},\n",
+       "   'lowercase': {'min_pass_rate': 0.7}}}}"
+      ]
+     },
+     "execution_count": 6,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "harness.configure({\n",
+    "    \"tests\":{\n",
+    "        \"defaults\":{\"min_pass_rate\":0.5},\n",
+    "        \"robustness\":{\n",
+    "            \"add_typo\":{\"min_pass_rate\":0.7},\n",
+    "            \"lowercase\":{\"min_pass_rate\":0.7},\n",
+    "        }\n",
+    "    }\n",
+    "})"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 7,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "harness.data=harness.data[:10]"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Generating the test cases."
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 8,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Generating testcases...: 100%|██████████| 1/1 [00:00<?, ?it/s]\n",
+      "WARNING:root:Removing samples where no transformation has been applied:\n",
+      "- Test 'add_typo': 1 samples removed out of 10\n",
+      "\n"
+     ]
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 8,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "harness.generate()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 9,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>category</th>\n",
+       "      <th>test_type</th>\n",
+       "      <th>original_context</th>\n",
+       "      <th>original_question</th>\n",
+       "      <th>perturbed_context</th>\n",
+       "      <th>perturbed_question</th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are there?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are thers?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by composer Johan...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some examxle tracks by composer Johan...</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by Bach?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some sxample tracks by Bach?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are also customers?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Tow many employees are also customers?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>4</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Where is Mark Telus from?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Where is Mark Telys from?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>5</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common genre of songs?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most sommon genre of songs?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>6</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Whst is the most common media type?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>7</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media typw?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>8</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many more Protected AAC audio files are th...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many more Protected AAC audio foles are th...</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>9</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are there?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many employees are there?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>10</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by composer Johan...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what are some example tracks by composer johan...</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>11</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by Bach?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what are some example tracks by bach?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>12</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are also customers?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many employees are also customers?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>13</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Where is Mark Telus from?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>where is mark telus from?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>14</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common genre of songs?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what is the most common genre of songs?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>15</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what is the most common media type?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>16</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what is the most common media type?</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>17</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many more Protected AAC audio files are th...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many more protected aac audio files are th...</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>18</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many albums are there</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many albums are there</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "      category  test_type original_context  \\\n",
+       "0   robustness   add_typo                -   \n",
+       "1   robustness   add_typo                -   \n",
+       "2   robustness   add_typo                -   \n",
+       "3   robustness   add_typo                -   \n",
+       "4   robustness   add_typo                -   \n",
+       "5   robustness   add_typo                -   \n",
+       "6   robustness   add_typo                -   \n",
+       "7   robustness   add_typo                -   \n",
+       "8   robustness   add_typo                -   \n",
+       "9   robustness  lowercase                -   \n",
+       "10  robustness  lowercase                -   \n",
+       "11  robustness  lowercase                -   \n",
+       "12  robustness  lowercase                -   \n",
+       "13  robustness  lowercase                -   \n",
+       "14  robustness  lowercase                -   \n",
+       "15  robustness  lowercase                -   \n",
+       "16  robustness  lowercase                -   \n",
+       "17  robustness  lowercase                -   \n",
+       "18  robustness  lowercase                -   \n",
+       "\n",
+       "                                    original_question perturbed_context  \\\n",
+       "0                       How many employees are there?                 -   \n",
+       "1   What are some example tracks by composer Johan...                 -   \n",
+       "2               What are some example tracks by Bach?                 -   \n",
+       "3              How many employees are also customers?                 -   \n",
+       "4                           Where is Mark Telus from?                 -   \n",
+       "5             What is the most common genre of songs?                 -   \n",
+       "6                 What is the most common media type?                 -   \n",
+       "7                 What is the most common media type?                 -   \n",
+       "8   How many more Protected AAC audio files are th...                 -   \n",
+       "9                       How many employees are there?                 -   \n",
+       "10  What are some example tracks by composer Johan...                 -   \n",
+       "11              What are some example tracks by Bach?                 -   \n",
+       "12             How many employees are also customers?                 -   \n",
+       "13                          Where is Mark Telus from?                 -   \n",
+       "14            What is the most common genre of songs?                 -   \n",
+       "15                What is the most common media type?                 -   \n",
+       "16                What is the most common media type?                 -   \n",
+       "17  How many more Protected AAC audio files are th...                 -   \n",
+       "18                          How many albums are there                 -   \n",
+       "\n",
+       "                                   perturbed_question  \n",
+       "0                       How many employees are thers?  \n",
+       "1   What are some examxle tracks by composer Johan...  \n",
+       "2               What are some sxample tracks by Bach?  \n",
+       "3              Tow many employees are also customers?  \n",
+       "4                           Where is Mark Telys from?  \n",
+       "5             What is the most sommon genre of songs?  \n",
+       "6                 Whst is the most common media type?  \n",
+       "7                 What is the most common media typw?  \n",
+       "8   How many more Protected AAC audio foles are th...  \n",
+       "9                       how many employees are there?  \n",
+       "10  what are some example tracks by composer johan...  \n",
+       "11              what are some example tracks by bach?  \n",
+       "12             how many employees are also customers?  \n",
+       "13                          where is mark telus from?  \n",
+       "14            what is the most common genre of songs?  \n",
+       "15                what is the most common media type?  \n",
+       "16                what is the most common media type?  \n",
+       "17  how many more protected aac audio files are th...  \n",
+       "18                          how many albums are there  "
+      ]
+     },
+     "execution_count": 9,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "harness.testcases()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "harness.generate() method automatically generates the test cases (based on the provided configuration)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Running the tests"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 10,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Running testcases... : 100%|██████████| 19/19 [00:43<00:00,  2.28s/it]\n"
+     ]
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 10,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "harness.run()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "Called after harness.generate() and is to used to run all the tests.  Returns a pass/fail flag for each test."
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Generated Results"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>category</th>\n",
+       "      <th>test_type</th>\n",
+       "      <th>original_context</th>\n",
+       "      <th>original_question</th>\n",
+       "      <th>perturbed_context</th>\n",
+       "      <th>perturbed_question</th>\n",
+       "      <th>expected_result</th>\n",
+       "      <th>actual_result</th>\n",
+       "      <th>pass</th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are there?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are thers?</td>\n",
+       "      <td>The exact number of employees is not availabl...</td>\n",
+       "      <td>The number of employees varies depending on t...</td>\n",
+       "      <td>False</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by composer Johan...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some examxle tracks by composer Johan...</td>\n",
+       "      <td>Some of Johann Sebastian Bach's most famous c...</td>\n",
+       "      <td>Some of Johann Sebastian Bach's most famous t...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by Bach?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some sxample tracks by Bach?</td>\n",
+       "      <td>Some of Johann Sebastian Bach's most famous t...</td>\n",
+       "      <td>Some examples of tracks by Bach include \"Air ...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are also customers?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Tow many employees are also customers?</td>\n",
+       "      <td>The number of employees who are also customer...</td>\n",
+       "      <td>The number of employees who are also customer...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>4</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Where is Mark Telus from?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Where is Mark Telys from?</td>\n",
+       "      <td>Mark Telus is from Canada.</td>\n",
+       "      <td>Mark Telys is from the United States of America.</td>\n",
+       "      <td>False</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>5</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common genre of songs?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most sommon genre of songs?</td>\n",
+       "      <td>The most common genre of songs is pop music.</td>\n",
+       "      <td>The most common genre of songs is pop music.</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>6</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Whst is the most common media type?</td>\n",
+       "      <td>The most common media type is text/html.</td>\n",
+       "      <td>The most common media type is text/html.</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>7</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media typw?</td>\n",
+       "      <td>The most common media type is text/html.</td>\n",
+       "      <td>The most common media type is digital media, ...</td>\n",
+       "      <td>False</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>8</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many more Protected AAC audio files are th...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many more Protected AAC audio foles are th...</td>\n",
+       "      <td>There is no definitive answer to this questio...</td>\n",
+       "      <td>There is no definitive answer to this questio...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>9</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are there?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many employees are there?</td>\n",
+       "      <td>The exact number of employees is not availabl...</td>\n",
+       "      <td>The exact number of employees varies dependin...</td>\n",
+       "      <td>False</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>10</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by composer Johan...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what are some example tracks by composer johan...</td>\n",
+       "      <td>Some of Johann Sebastian Bach's most famous c...</td>\n",
+       "      <td>Some of Johann Sebastian Bach's most famous c...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>11</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What are some example tracks by Bach?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what are some example tracks by bach?</td>\n",
+       "      <td>Some of Johann Sebastian Bach's most famous t...</td>\n",
+       "      <td>Some examples of tracks by Johann Sebastian B...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>12</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many employees are also customers?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many employees are also customers?</td>\n",
+       "      <td>The number of employees who are also customer...</td>\n",
+       "      <td>It depends on the company.</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>13</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>Where is Mark Telus from?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>where is mark telus from?</td>\n",
+       "      <td>Mark Telus is from Canada.</td>\n",
+       "      <td>Mark Telus is from Canada.</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>14</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common genre of songs?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what is the most common genre of songs?</td>\n",
+       "      <td>The most common genre of songs is pop music.</td>\n",
+       "      <td>The most common genre of songs is pop music.</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>15</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what is the most common media type?</td>\n",
+       "      <td>The most common media type is text/html.</td>\n",
+       "      <td>The most common media type is text/html.</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>16</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>What is the most common media type?</td>\n",
+       "      <td>-</td>\n",
+       "      <td>what is the most common media type?</td>\n",
+       "      <td>The most common media type is text/html.</td>\n",
+       "      <td>The most common media type is text/plain.</td>\n",
+       "      <td>False</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>17</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many more Protected AAC audio files are th...</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many more protected aac audio files are th...</td>\n",
+       "      <td>There is no definitive answer to this questio...</td>\n",
+       "      <td>It is not possible to answer this question wi...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>18</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>-</td>\n",
+       "      <td>How many albums are there</td>\n",
+       "      <td>-</td>\n",
+       "      <td>how many albums are there</td>\n",
+       "      <td>The exact number of albums varies depending o...</td>\n",
+       "      <td>The exact number of albums released is diffic...</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "      category  test_type original_context  \\\n",
+       "0   robustness   add_typo                -   \n",
+       "1   robustness   add_typo                -   \n",
+       "2   robustness   add_typo                -   \n",
+       "3   robustness   add_typo                -   \n",
+       "4   robustness   add_typo                -   \n",
+       "5   robustness   add_typo                -   \n",
+       "6   robustness   add_typo                -   \n",
+       "7   robustness   add_typo                -   \n",
+       "8   robustness   add_typo                -   \n",
+       "9   robustness  lowercase                -   \n",
+       "10  robustness  lowercase                -   \n",
+       "11  robustness  lowercase                -   \n",
+       "12  robustness  lowercase                -   \n",
+       "13  robustness  lowercase                -   \n",
+       "14  robustness  lowercase                -   \n",
+       "15  robustness  lowercase                -   \n",
+       "16  robustness  lowercase                -   \n",
+       "17  robustness  lowercase                -   \n",
+       "18  robustness  lowercase                -   \n",
+       "\n",
+       "                                    original_question perturbed_context  \\\n",
+       "0                       How many employees are there?                 -   \n",
+       "1   What are some example tracks by composer Johan...                 -   \n",
+       "2               What are some example tracks by Bach?                 -   \n",
+       "3              How many employees are also customers?                 -   \n",
+       "4                           Where is Mark Telus from?                 -   \n",
+       "5             What is the most common genre of songs?                 -   \n",
+       "6                 What is the most common media type?                 -   \n",
+       "7                 What is the most common media type?                 -   \n",
+       "8   How many more Protected AAC audio files are th...                 -   \n",
+       "9                       How many employees are there?                 -   \n",
+       "10  What are some example tracks by composer Johan...                 -   \n",
+       "11              What are some example tracks by Bach?                 -   \n",
+       "12             How many employees are also customers?                 -   \n",
+       "13                          Where is Mark Telus from?                 -   \n",
+       "14            What is the most common genre of songs?                 -   \n",
+       "15                What is the most common media type?                 -   \n",
+       "16                What is the most common media type?                 -   \n",
+       "17  How many more Protected AAC audio files are th...                 -   \n",
+       "18                          How many albums are there                 -   \n",
+       "\n",
+       "                                   perturbed_question  \\\n",
+       "0                       How many employees are thers?   \n",
+       "1   What are some examxle tracks by composer Johan...   \n",
+       "2               What are some sxample tracks by Bach?   \n",
+       "3              Tow many employees are also customers?   \n",
+       "4                           Where is Mark Telys from?   \n",
+       "5             What is the most sommon genre of songs?   \n",
+       "6                 Whst is the most common media type?   \n",
+       "7                 What is the most common media typw?   \n",
+       "8   How many more Protected AAC audio foles are th...   \n",
+       "9                       how many employees are there?   \n",
+       "10  what are some example tracks by composer johan...   \n",
+       "11              what are some example tracks by bach?   \n",
+       "12             how many employees are also customers?   \n",
+       "13                          where is mark telus from?   \n",
+       "14            what is the most common genre of songs?   \n",
+       "15                what is the most common media type?   \n",
+       "16                what is the most common media type?   \n",
+       "17  how many more protected aac audio files are th...   \n",
+       "18                          how many albums are there   \n",
+       "\n",
+       "                                      expected_result  \\\n",
+       "0    The exact number of employees is not availabl...   \n",
+       "1    Some of Johann Sebastian Bach's most famous c...   \n",
+       "2    Some of Johann Sebastian Bach's most famous t...   \n",
+       "3    The number of employees who are also customer...   \n",
+       "4                          Mark Telus is from Canada.   \n",
+       "5        The most common genre of songs is pop music.   \n",
+       "6            The most common media type is text/html.   \n",
+       "7            The most common media type is text/html.   \n",
+       "8    There is no definitive answer to this questio...   \n",
+       "9    The exact number of employees is not availabl...   \n",
+       "10   Some of Johann Sebastian Bach's most famous c...   \n",
+       "11   Some of Johann Sebastian Bach's most famous t...   \n",
+       "12   The number of employees who are also customer...   \n",
+       "13                         Mark Telus is from Canada.   \n",
+       "14       The most common genre of songs is pop music.   \n",
+       "15           The most common media type is text/html.   \n",
+       "16           The most common media type is text/html.   \n",
+       "17   There is no definitive answer to this questio...   \n",
+       "18   The exact number of albums varies depending o...   \n",
+       "\n",
+       "                                        actual_result   pass  \n",
+       "0    The number of employees varies depending on t...  False  \n",
+       "1    Some of Johann Sebastian Bach's most famous t...   True  \n",
+       "2    Some examples of tracks by Bach include \"Air ...   True  \n",
+       "3    The number of employees who are also customer...   True  \n",
+       "4    Mark Telys is from the United States of America.  False  \n",
+       "5        The most common genre of songs is pop music.   True  \n",
+       "6            The most common media type is text/html.   True  \n",
+       "7    The most common media type is digital media, ...  False  \n",
+       "8    There is no definitive answer to this questio...   True  \n",
+       "9    The exact number of employees varies dependin...  False  \n",
+       "10   Some of Johann Sebastian Bach's most famous c...   True  \n",
+       "11   Some examples of tracks by Johann Sebastian B...   True  \n",
+       "12                         It depends on the company.   True  \n",
+       "13                         Mark Telus is from Canada.   True  \n",
+       "14       The most common genre of songs is pop music.   True  \n",
+       "15           The most common media type is text/html.   True  \n",
+       "16          The most common media type is text/plain.  False  \n",
+       "17   It is not possible to answer this question wi...   True  \n",
+       "18   The exact number of albums released is diffic...   True  "
+      ]
+     },
+     "execution_count": 11,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "harness.generated_results()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "This method returns the generated results in the form of a pandas dataframe, which provides a convenient and easy-to-use format for working with the test results. You can use this method to quickly identify the test cases that failed and to determine where fixes are needed."
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Final Results\n",
+    "\n",
+    "We can call `.report()` which summarizes the results giving information about pass and fail counts and overall test pass/fail flag."
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 12,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>category</th>\n",
+       "      <th>test_type</th>\n",
+       "      <th>fail_count</th>\n",
+       "      <th>pass_count</th>\n",
+       "      <th>pass_rate</th>\n",
+       "      <th>minimum_pass_rate</th>\n",
+       "      <th>pass</th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>add_typo</td>\n",
+       "      <td>3</td>\n",
+       "      <td>6</td>\n",
+       "      <td>67%</td>\n",
+       "      <td>70%</td>\n",
+       "      <td>False</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <td>robustness</td>\n",
+       "      <td>lowercase</td>\n",
+       "      <td>2</td>\n",
+       "      <td>8</td>\n",
+       "      <td>80%</td>\n",
+       "      <td>70%</td>\n",
+       "      <td>True</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "     category  test_type  fail_count  pass_count pass_rate minimum_pass_rate  \\\n",
+       "0  robustness   add_typo           3           6       67%               70%   \n",
+       "1  robustness  lowercase           2           8       80%               70%   \n",
+       "\n",
+       "    pass  \n",
+       "0  False  \n",
+       "1   True  "
+      ]
+     },
+     "execution_count": 12,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "harness.report()"
+   ]
   }
  ],
  "metadata": {
@@ -5581,7 +6556,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.10.9"
+   "version": "3.11.4"
   },
   "widgets": {
    "application/vnd.jupyter.widget-state+json": {


Test patch:
diff --git a/langtest/datahandler/datasource.py b/langtest/datahandler/datasource.py
index 0f5f79e55..fe1e79d12 100644
--- a/langtest/datahandler/datasource.py
+++ b/langtest/datahandler/datasource.py
@@ -867,16 +867,20 @@ def load_data_summarization(
             feature_column = self._file_path.get("feature_column", "document")
             target_column = self._file_path.get("target_column", "summary")
 
-            if (
-                feature_column not in dataset.columns
-                or target_column not in dataset.columns
-            ):
+            if feature_column not in dataset.columns:
                 raise ValueError(
-                    f"Columns '{feature_column}' and '{target_column}' not found in the dataset."
+                    f"feature_column '{feature_column}' not found in the dataset."
+                )
+            if target_column not in dataset.columns:
+                logging.warning(
+                    f"target_column '{target_column}' not found in the dataset."
                 )
+                dataset["summary"] = None
+            else:
+                dataset.rename(columns={target_column: "summary"}, inplace=True)
 
             dataset.rename(
-                columns={feature_column: "document", target_column: "summary"},
+                columns={feature_column: "document"},
                 inplace=True,
             )
 
@@ -924,25 +928,29 @@ def load_data_question_answering(
                 raise ValueError(
                     f"'feature_column' '{feature_column['question']}' not found in the dataset."
                 )
-            if "answer" not in target_column or target_column not in dataset_columns:
-                raise ValueError(
-                    f"'target_column' '{target_column}' not found in the dataset."
+
+            if target_column not in dataset_columns:
+                logging.warning(
+                    f"target_column '{target_column}' not found in the dataset."
                 )
+                dataset["answer"] = None
+            else:
+                dataset.rename(columns={target_column: "answer"}, inplace=True)
 
-            if passage_column in dataset.columns:
+            if passage_column:
                 if passage_column not in dataset_columns:
-                    raise ValueError(
+                    logging.warning(
                         f"'feature_column' '{passage_column}' not found in the dataset."
                     )
-                dataset.rename(columns={passage_column: "passage"}, inplace=True)
+                    dataset["passage"] = "-"
+                else:
+                    dataset.rename(columns={passage_column: "passage"}, inplace=True)
             else:
                 dataset["passage"] = "-"
 
             if question_column in dataset.columns:
                 dataset.rename(columns={question_column: "question"}, inplace=True)
 
-            dataset.rename(columns={target_column: "answer"}, inplace=True)
-
         samples = [
             self._row_to_sample_question_answering(row) for _, row in dataset.iterrows()
         ]
@@ -1074,13 +1082,16 @@ def _row_to_sample_question_answering(self, row: pd.Series) -> QASample:
         if type(self._file_path) == dict:
             question = row.loc["question"]
             passage = row.loc["passage"]
+            answer = row.loc["answer"]
         else:
             question = row[self.column_map["text"]]
             passage = row[self.column_map["context"]]
+            answer = row[self.column_map["answer"]]
 
         return QASample(
             original_question=question,
             original_context=passage,
+            expected_results=answer,
             task="question-answering",
         )
 
@@ -1357,7 +1368,12 @@ def export_data(self, data: List[Sample], output_path: str):
 class HuggingFaceDataset(_IDataset):
     """Example dataset class that loads data using the Hugging Face dataset library."""
 
-    supported_tasks = ["text-classification", "summarization", "ner"]
+    supported_tasks = [
+        "text-classification",
+        "summarization",
+        "ner",
+        "question-answering",
+    ]
 
     LIB_NAME = "datasets"
     COLUMN_NAMES = {task: COLUMN_MAPPER[task] for task in supported_tasks}
@@ -1500,21 +1516,31 @@ def load_data_summarization(
         else:
             dataset = self.load_dataset(self.dataset_name, split=split)
 
-        if feature_column and target_column:
-            dataset = dataset.map(
-                lambda example: {
-                    "document": example[feature_column],
-                    "summary": example[target_column],
-                }
+        dataset = pd.DataFrame(dataset)
+
+        if feature_column not in dataset.columns:
+            raise ValueError(
+                f"feature_column '{feature_column}' not found in the dataset."
             )
+        if target_column not in dataset.columns:
+            logging.warning(f"target_column '{target_column}' not found in the dataset.")
+            dataset["summary"] = None
+        else:
+            dataset.rename(columns={target_column: "summary"}, inplace=True)
 
-        samples = [self._row_to_sample_summarization(example) for example in dataset]
+        dataset.rename(
+            columns={feature_column: "document"},
+            inplace=True,
+        )
+
+        samples = [
+            self._row_to_sample_summarization(row) for _, row in dataset.iterrows()
+        ]
         return samples
 
     def load_data_qa(
         self,
-        question_column: str,
-        context_column: str,
+        feature_column: dict,
         target_column: str,
         split: str,
         subset: str = None,
@@ -1523,9 +1549,9 @@ def load_data_qa(
 
         Args:
             feature_column (str):
-                Name of the column containing the input text or document.
+                Name of the column containing the input question or passage.
             target_column (str):
-                Name of the column containing the target summary.
+                Name of the column containing the target answer.
             split (str):
                 Name of the split to load (e.g., train, validation, test).
             subset (str):
@@ -1535,24 +1561,48 @@ def load_data_qa(
             List[Sample]:
                 Loaded split as a list of Sample objects for QA task.
         """
-        question_column = "question" if question_column is None else question_column
-        target_column = "answer" if target_column is None else target_column
-        split = "test" if split is None else split
 
         if subset:
             dataset = self.load_dataset(self.dataset_name, name=subset, split=split)
+
         else:
             dataset = self.load_dataset(self.dataset_name, split=split)
 
-        dataset = dataset.map(
-            lambda example: {
-                "question": example[question_column],
-                "context": example[context_column],
-                "answer": example[target_column],
-            }
-        )
+        dataset = pd.DataFrame(dataset)
+
+        passage_column = feature_column.get("passage")
+        question_column = feature_column.get("question")
+
+        dataset_columns = set(dataset.columns)
+        if (
+            "question" not in feature_column
+            or feature_column["question"] not in dataset_columns
+        ):
+            raise ValueError(
+                f"'feature_column' '{feature_column['question']}' not found in the dataset."
+            )
 
-        samples = [self._row_to_sample_qa(example) for example in dataset]
+        if target_column not in dataset_columns:
+            logging.warning(f"target_column '{target_column}' not found in the dataset.")
+            dataset["answer"] = None
+        else:
+            dataset.rename(columns={target_column: "answer"}, inplace=True)
+
+        if passage_column:
+            if passage_column not in dataset_columns:
+                logging.warning(
+                    f"'feature_column' '{passage_column}' not found in the dataset."
+                )
+                dataset["passage"] = "-"
+            else:
+                dataset.rename(columns={passage_column: "passage"}, inplace=True)
+        else:
+            dataset["passage"] = "-"
+
+        if question_column in dataset.columns:
+            dataset.rename(columns={question_column: "question"}, inplace=True)
+
+        samples = [self._row_to_sample_qa(row) for _, row in dataset.iterrows()]
         return samples
 
     def load_raw_data(
@@ -1605,11 +1655,15 @@ def load_data(
             )
         elif self.task == "ner":
             return self.load_data_ner(feature_column, target_column, split, subset)
+
+        elif self.task == "question-answering":
+            return self.load_data_qa(feature_column, target_column, split, subset)
+
         else:
             raise ValueError(f"Unsupported task for HF datasets: {self.task}")
 
     @staticmethod
-    def _row_to_sample_summarization(data_row: Dict[str, str]) -> Sample:
+    def _row_to_sample_summarization(row: pd.Series) -> Sample:
         """Convert a row from the dataset into a Sample for summarization.
 
         Args:
@@ -1620,13 +1674,13 @@ def _row_to_sample_summarization(data_row: Dict[str, str]) -> Sample:
             Sample:
                 Row formatted into a Sample object for summarization.
         """
-        original = data_row.get("document", "")
-        summary = data_row.get("summary", "")
+        original = row.loc["document"]
+        summary = row.loc["summary"]
 
         return SummarizationSample(original=original, expected_results=summary)
 
     @staticmethod
-    def _row_to_sample_qa(data_row: Dict[str, str]) -> Sample:
+    def _row_to_sample_qa(row: pd.Series) -> QASample:
         """Convert a row from the dataset into a Sample for summarization.
 
         Args:
@@ -1637,16 +1691,13 @@ def _row_to_sample_qa(data_row: Dict[str, str]) -> Sample:
             Sample:
                 Row formatted into a Sample object for summarization.
         """
-        context = data_row.get("context", "")
-        question = data_row.get("question", "")
-        answer = data_row.get("answer", "")
-        if isinstance(answer, str):
-            answer = [answer]
-
+        question = row.loc["question"]
+        passage = row.loc["passage"]
+        answer = row.loc["answer"]
         return QASample(
             original_question=question,
-            original_context=context,
-            actual_results=answer,
+            original_context=passage,
+            expected_results=answer,
         )
 
     def export_data(self, data: List[Sample], output_path: str):
diff --git a/langtest/langtest.py b/langtest/langtest.py
index e6be25b7f..4847fef97 100644
--- a/langtest/langtest.py
+++ b/langtest/langtest.py
@@ -73,7 +73,7 @@ class Harness:
     }
     SUPPORTED_HUBS_HF_DATASET_NER = ["johnsnowlabs", "huggingface", "spacy"]
     SUPPORTED_HUBS_HF_DATASET_CLASSIFICATION = ["johnsnowlabs", "huggingface", "spacy"]
-    SUPPORTED_HUBS_HF_DATASET_SUMMARIZATION = [
+    SUPPORTED_HUBS_HF_DATASET_LLM = [
         "openai",
         "cohere",
         "ai21",
@@ -231,11 +231,19 @@ def __init__(
                     split=data.get("split", "test"),
                     subset=data.get("subset", None),
                 )
-
             elif (
-                task == "summarization"
-                and hub in self.SUPPORTED_HUBS_HF_DATASET_SUMMARIZATION
+                task == "question-answering" and hub in self.SUPPORTED_HUBS_HF_DATASET_LLM
             ):
+                self.data = HuggingFaceDataset(data["data_source"], task=task).load_data(
+                    feature_column=data.get(
+                        "feature_column", {"passage": "passage", "question": "question"}
+                    ),
+                    target_column=data.get("target_column", "answer"),
+                    split=data.get("split", "test"),
+                    subset=data.get("subset", None),
+                )
+
+            elif task == "summarization" and hub in self.SUPPORTED_HUBS_HF_DATASET_LLM:
                 self.data = HuggingFaceDataset(data["data_source"], task=task).load_data(
                     feature_column=data.get("feature_column", "document"),
                     target_column=data.get("target_column", "summary"),
diff --git a/langtest/transform/__init__.py b/langtest/transform/__init__.py
index cb4bd1192..d5836ef55 100644
--- a/langtest/transform/__init__.py
+++ b/langtest/transform/__init__.py
@@ -1155,7 +1155,11 @@ def run(
             y_pred = y_pred.explode()
 
         elif raw_data[0].task == "question-answering":
-            dataset_name = raw_data[0].dataset_name.split("-")[0].lower()
+            if raw_data[0].dataset_name is None:
+                dataset_name = "default_question_answering_prompt"
+            else:
+                dataset_name = raw_data[0].dataset_name.split("-")[0].lower()
+
             prompt_template = kwargs.get(
                 "user_prompt", default_user_prompt.get(dataset_name, "")
             )
@@ -1177,7 +1181,10 @@ def run(
             y_pred = y_pred.apply(lambda x: x.strip())
 
         elif raw_data[0].task == "summarization":
-            dataset_name = raw_data[0].dataset_name.split("-")[0].lower()
+            if raw_data[0].dataset_name is None:
+                dataset_name = "default_summarization_prompt"
+            else:
+                dataset_name = raw_data[0].dataset_name.split("-")[0].lower()
             prompt_template = kwargs.get(
                 "user_prompt", default_user_prompt.get(dataset_name, "")
             )