|  | 
| 14 | 14 |   }, | 
| 15 | 15 |   { | 
| 16 | 16 |    "cell_type": "code", | 
| 17 |  | -   "execution_count": 1, | 
|  | 17 | +   "execution_count": 2, | 
| 18 | 18 |    "metadata": {}, | 
| 19 | 19 |    "outputs": [ | 
| 20 | 20 |     { | 
| 21 | 21 |      "name": "stdout", | 
| 22 | 22 |      "output_type": "stream", | 
| 23 | 23 |      "text": [ | 
| 24 |  | -      "\n", | 
| 25 |  | -      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.1.1\u001b[0m\n", | 
| 26 |  | -      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", | 
| 27 |  | -      "\n", | 
| 28 |  | -      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.1.1\u001b[0m\n", | 
| 29 |  | -      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", | 
| 30 |  | -      "\u001b[38;5;2m✔ Download and installation successful\u001b[0m\n", | 
|  | 24 | +      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", | 
|  | 25 | +      "sagemaker 2.232.2 requires numpy<2.0,>=1.9.0, but you have numpy 2.0.2 which is incompatible.\u001b[0m\u001b[31m\n", | 
|  | 26 | +      "\u001b[0m\u001b[38;5;2m✔ Download and installation successful\u001b[0m\n", | 
| 31 | 27 |       "You can now load the package via spacy.load('en_core_web_lg')\n", | 
| 32 | 28 |       "Installing hub:\u001b[35m/\u001b[0m\u001b[35m/guardrails/\u001b[0m\u001b[95mdetect_pii...\u001b[0m\n", | 
| 33 | 29 |       "✅Successfully installed guardrails/detect_pii!\n", | 
|  | 
| 46 | 42 |   }, | 
| 47 | 43 |   { | 
| 48 | 44 |    "cell_type": "code", | 
| 49 |  | -   "execution_count": 2, | 
|  | 45 | +   "execution_count": 1, | 
| 50 | 46 |    "metadata": {}, | 
| 51 | 47 |    "outputs": [], | 
| 52 | 48 |    "source": [ | 
|  | 
| 58 | 54 |   }, | 
| 59 | 55 |   { | 
| 60 | 56 |    "cell_type": "code", | 
| 61 |  | -   "execution_count": 3, | 
|  | 57 | +   "execution_count": 2, | 
| 62 | 58 |    "metadata": {}, | 
| 63 | 59 |    "outputs": [], | 
| 64 | 60 |    "source": [ | 
|  | 
| 72 | 68 |   }, | 
| 73 | 69 |   { | 
| 74 | 70 |    "cell_type": "code", | 
| 75 |  | -   "execution_count": 4, | 
|  | 71 | +   "execution_count": 3, | 
| 76 | 72 |    "metadata": {}, | 
| 77 | 73 |    "outputs": [ | 
|  | 74 | +    { | 
|  | 75 | +     "name": "stderr", | 
|  | 76 | +     "output_type": "stream", | 
|  | 77 | +     "text": [ | 
|  | 78 | +      "/Users/dtam/dev/guardrails/guardrails/validator_service/__init__.py:85: UserWarning: Could not obtain an event loop. Falling back to synchronous validation.\n", | 
|  | 79 | +      "  warnings.warn(\n" | 
|  | 80 | +     ] | 
|  | 81 | +    }, | 
| 78 | 82 |     { | 
| 79 | 83 |      "data": { | 
| 80 | 84 |       "text/html": [ | 
| 81 | 85 |        "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ValidationOutcome</span><span style=\"font-weight: bold\">(</span>\n", | 
| 82 |  | -       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'11369602960'</span>,\n", | 
|  | 86 | +       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'14118728112'</span>,\n", | 
| 83 | 87 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">raw_llm_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'My email address is [email protected], and my phone number is 1234567890'</span>,\n", | 
| 84 | 88 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">validated_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'My email address is <EMAIL_ADDRESS>, and my phone number is <PHONE_NUMBER>'</span>,\n", | 
| 85 | 89 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">reask</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n", | 
|  | 
| 90 | 94 |       ], | 
| 91 | 95 |       "text/plain": [ | 
| 92 | 96 |        "\u001b[1;35mValidationOutcome\u001b[0m\u001b[1m(\u001b[0m\n", | 
| 93 |  | -       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'11369602960'\u001b[0m,\n", | 
|  | 97 | +       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'14118728112'\u001b[0m,\n", | 
| 94 | 98 |        "    \u001b[33mraw_llm_output\u001b[0m=\u001b[32m'My email address is [email protected], and my phone number is 1234567890'\u001b[0m,\n", | 
| 95 | 99 |        "    \u001b[33mvalidated_output\u001b[0m=\u001b[32m'My email address is \u001b[0m\u001b[32m<\u001b[0m\u001b[32mEMAIL_ADDRESS\u001b[0m\u001b[32m>, and my phone number is <PHONE_NUMBER\u001b[0m\u001b[32m>\u001b[0m\u001b[32m'\u001b[0m,\n", | 
| 96 | 100 |        "    \u001b[33mreask\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", | 
|  | 
| 123 | 127 |   }, | 
| 124 | 128 |   { | 
| 125 | 129 |    "cell_type": "code", | 
| 126 |  | -   "execution_count": 5, | 
|  | 130 | +   "execution_count": 4, | 
| 127 | 131 |    "metadata": {}, | 
| 128 | 132 |    "outputs": [ | 
|  | 133 | +    { | 
|  | 134 | +     "name": "stderr", | 
|  | 135 | +     "output_type": "stream", | 
|  | 136 | +     "text": [ | 
|  | 137 | +      "/Users/dtam/dev/guardrails/guardrails/validator_service/__init__.py:85: UserWarning: Could not obtain an event loop. Falling back to synchronous validation.\n", | 
|  | 138 | +      "  warnings.warn(\n" | 
|  | 139 | +     ] | 
|  | 140 | +    }, | 
| 129 | 141 |     { | 
| 130 | 142 |      "data": { | 
| 131 | 143 |       "text/html": [ | 
| 132 | 144 |        "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ValidationOutcome</span><span style=\"font-weight: bold\">(</span>\n", | 
| 133 |  | -       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'12272632448'</span>,\n", | 
|  | 145 | +       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'14120164704'</span>,\n", | 
| 134 | 146 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">raw_llm_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'My email address is [email protected], and my phone number is 1234567890'</span>,\n", | 
| 135 | 147 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">validated_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'My email address is <EMAIL_ADDRESS>, and my phone number is 1234567890'</span>,\n", | 
| 136 | 148 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">reask</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n", | 
|  | 
| 141 | 153 |       ], | 
| 142 | 154 |       "text/plain": [ | 
| 143 | 155 |        "\u001b[1;35mValidationOutcome\u001b[0m\u001b[1m(\u001b[0m\n", | 
| 144 |  | -       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'12272632448'\u001b[0m,\n", | 
|  | 156 | +       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'14120164704'\u001b[0m,\n", | 
| 145 | 157 |        "    \u001b[33mraw_llm_output\u001b[0m=\u001b[32m'My email address is [email protected], and my phone number is 1234567890'\u001b[0m,\n", | 
| 146 | 158 |        "    \u001b[33mvalidated_output\u001b[0m=\u001b[32m'My email address is \u001b[0m\u001b[32m<\u001b[0m\u001b[32mEMAIL_ADDRESS\u001b[0m\u001b[32m>\u001b[0m\u001b[32m, and my phone number is 1234567890'\u001b[0m,\n", | 
| 147 | 159 |        "    \u001b[33mreask\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", | 
|  | 
| 175 | 187 |   }, | 
| 176 | 188 |   { | 
| 177 | 189 |    "cell_type": "code", | 
| 178 |  | -   "execution_count": 6, | 
|  | 190 | +   "execution_count": 5, | 
| 179 | 191 |    "metadata": {}, | 
| 180 | 192 |    "outputs": [], | 
| 181 | 193 |    "source": [ | 
|  | 
| 186 | 198 |   }, | 
| 187 | 199 |   { | 
| 188 | 200 |    "cell_type": "code", | 
| 189 |  | -   "execution_count": 7, | 
|  | 201 | +   "execution_count": 6, | 
| 190 | 202 |    "metadata": {}, | 
| 191 | 203 |    "outputs": [ | 
|  | 204 | +    { | 
|  | 205 | +     "name": "stderr", | 
|  | 206 | +     "output_type": "stream", | 
|  | 207 | +     "text": [ | 
|  | 208 | +      "/Users/dtam/dev/guardrails/guardrails/validator_service/__init__.py:85: UserWarning: Could not obtain an event loop. Falling back to synchronous validation.\n", | 
|  | 209 | +      "  warnings.warn(\n" | 
|  | 210 | +     ] | 
|  | 211 | +    }, | 
| 192 | 212 |     { | 
| 193 | 213 |      "data": { | 
| 194 | 214 |       "text/html": [ | 
| 195 | 215 |        "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ValidationOutcome</span><span style=\"font-weight: bold\">(</span>\n", | 
| 196 |  | -       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'11371854608'</span>,\n", | 
|  | 216 | +       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'14120171344'</span>,\n", | 
| 197 | 217 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">raw_llm_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'My email address is [email protected], and my account number is 1234789012367654.'</span>,\n", | 
| 198 | 218 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">validated_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'My email address is [email protected], and my account number is <US_BANK_NUMBER>.'</span>,\n", | 
| 199 | 219 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">reask</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n", | 
|  | 
| 204 | 224 |       ], | 
| 205 | 225 |       "text/plain": [ | 
| 206 | 226 |        "\u001b[1;35mValidationOutcome\u001b[0m\u001b[1m(\u001b[0m\n", | 
| 207 |  | -       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'11371854608'\u001b[0m,\n", | 
|  | 227 | +       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'14120171344'\u001b[0m,\n", | 
| 208 | 228 |        "    \u001b[33mraw_llm_output\u001b[0m=\u001b[32m'My email address is [email protected], and my account number is 1234789012367654.'\u001b[0m,\n", | 
| 209 | 229 |        "    \u001b[33mvalidated_output\u001b[0m=\u001b[32m'My email address is [email protected], and my account number is \u001b[0m\u001b[32m<\u001b[0m\u001b[32mUS_BANK_NUMBER\u001b[0m\u001b[32m>\u001b[0m\u001b[32m.'\u001b[0m,\n", | 
| 210 | 230 |        "    \u001b[33mreask\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", | 
|  | 
| 238 | 258 |   }, | 
| 239 | 259 |   { | 
| 240 | 260 |    "cell_type": "code", | 
| 241 |  | -   "execution_count": 8, | 
|  | 261 | +   "execution_count": 7, | 
| 242 | 262 |    "metadata": {}, | 
| 243 | 263 |    "outputs": [ | 
|  | 264 | +    { | 
|  | 265 | +     "name": "stderr", | 
|  | 266 | +     "output_type": "stream", | 
|  | 267 | +     "text": [ | 
|  | 268 | +      "/Users/dtam/dev/guardrails/guardrails/validator_service/__init__.py:85: UserWarning: Could not obtain an event loop. Falling back to synchronous validation.\n", | 
|  | 269 | +      "  warnings.warn(\n" | 
|  | 270 | +     ] | 
|  | 271 | +    }, | 
| 244 | 272 |     { | 
| 245 | 273 |      "data": { | 
| 246 | 274 |       "text/html": [ | 
| 247 | 275 |        "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ValidationOutcome</span><span style=\"font-weight: bold\">(</span>\n", | 
| 248 |  | -       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'11371849968'</span>,\n", | 
|  | 276 | +       "    <span style=\"color: #808000; text-decoration-color: #808000\">call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'14120169344'</span>,\n", | 
| 249 | 277 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">raw_llm_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">\"My ITIN is 923756789 and my driver's license number is 87651239\"</span>,\n", | 
| 250 | 278 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">validated_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">\"My ITIN is <US_ITIN> and my driver's license number is <US_DRIVER_LICENSE>\"</span>,\n", | 
| 251 | 279 |        "    <span style=\"color: #808000; text-decoration-color: #808000\">reask</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n", | 
|  | 
| 256 | 284 |       ], | 
| 257 | 285 |       "text/plain": [ | 
| 258 | 286 |        "\u001b[1;35mValidationOutcome\u001b[0m\u001b[1m(\u001b[0m\n", | 
| 259 |  | -       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'11371849968'\u001b[0m,\n", | 
|  | 287 | +       "    \u001b[33mcall_id\u001b[0m=\u001b[32m'14120169344'\u001b[0m,\n", | 
| 260 | 288 |        "    \u001b[33mraw_llm_output\u001b[0m=\u001b[32m\"My\u001b[0m\u001b[32m ITIN is 923756789 and my driver's license number is 87651239\"\u001b[0m,\n", | 
| 261 | 289 |        "    \u001b[33mvalidated_output\u001b[0m=\u001b[32m\"My\u001b[0m\u001b[32m ITIN is \u001b[0m\u001b[32m<\u001b[0m\u001b[32mUS_ITIN\u001b[0m\u001b[32m> and my driver's license number is <US_DRIVER_LICENSE\u001b[0m\u001b[32m>\u001b[0m\u001b[32m\"\u001b[0m,\n", | 
| 262 | 290 |        "    \u001b[33mreask\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", | 
|  | 
| 292 | 320 |  ], | 
| 293 | 321 |  "metadata": { | 
| 294 | 322 |   "kernelspec": { | 
| 295 |  | -   "display_name": "guard-venv", | 
|  | 323 | +   "display_name": "litellm", | 
| 296 | 324 |    "language": "python", | 
| 297 | 325 |    "name": "python3" | 
| 298 | 326 |   }, | 
|  | 
| 306 | 334 |    "name": "python", | 
| 307 | 335 |    "nbconvert_exporter": "python", | 
| 308 | 336 |    "pygments_lexer": "ipython3", | 
| 309 |  | -   "version": "3.12.1" | 
|  | 337 | +   "version": "3.12.3" | 
| 310 | 338 |   } | 
| 311 | 339 |  }, | 
| 312 | 340 |  "nbformat": 4, | 
|  | 
0 commit comments