Spaces:
Build error
Build error
File size: 54,920 Bytes
a80048a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import torch\n",
"from huggingface_hub import login\n",
"import pandas as pd\n",
"\n",
"\n",
"from src.chat import SchoolChatbot\n",
"from config import BASE_MODEL, MY_MODEL"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "25e32283f7ee4afe97fea3101c6d1e0a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\"\"\"\n",
"TODO: Add your Hugging Face token\n",
"Options:\n",
"1. Use login() and enter token when prompted. It won't ask for your token if you already logged in using the command: huggingface-cli login in the terminal.\n",
"2. Set environment variable HUGGINGFACE_TOKEN\n",
"3. Pass token directly (not recommended for shared notebooks)\n",
"\"\"\"\n",
"\n",
"login()"
]
},
{
"cell_type": "code",
"execution_count": 44,
"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>Neighborhood</th>\n",
" <th>Address</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Allston</td>\n",
" <td>123 Harvard Avenue, Boston, MA 02134</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Back Bay</td>\n",
" <td>500 Boylston Street, Boston, MA 02116</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Bay Village</td>\n",
" <td>15 Fayette Street, Boston, MA 02116</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Beacon Hill</td>\n",
" <td>21 Charles Street, Boston, MA 02114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Brighton</td>\n",
" <td>370 Washington Street, Boston, MA 02135</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Charlestown</td>\n",
" <td>1 Monument Square, Boston, MA 02129</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Chinatown–Leather District</td>\n",
" <td>66 Harrison Avenue, Boston, MA 02111</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Dorchester</td>\n",
" <td>1450 Dorchester Avenue, Boston, MA 02122</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Downtown</td>\n",
" <td>1 Washington Mall, Boston, MA 02108</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>East Boston</td>\n",
" <td>946 Bennington Street, Boston, MA 02128</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Fenway–Kenmore</td>\n",
" <td>4 Yawkey Way, Boston, MA 02215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>Hyde Park</td>\n",
" <td>1179 River Street, Boston, MA 02136</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>Jamaica Plain</td>\n",
" <td>403 Centre Street, Boston, MA 02130</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>Mattapan</td>\n",
" <td>1575 Blue Hill Avenue, Boston, MA 02126</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>Mission Hill</td>\n",
" <td>1575 Tremont Street, Boston, MA 02120</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>North End</td>\n",
" <td>226 Hanover Street, Boston, MA 02113</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>Roslindale</td>\n",
" <td>4195 Washington Street, Boston, MA 02131</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>Roxbury</td>\n",
" <td>2101 Washington Street, Boston, MA 02119</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>South Boston</td>\n",
" <td>200 Seaport Boulevard, Boston, MA 02210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>South End</td>\n",
" <td>541 Tremont Street, Boston, MA 02116</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>West End</td>\n",
" <td>100 Blossom Street, Boston, MA 02114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>West Roxbury</td>\n",
" <td>1885 Centre Street, Boston, MA 02132</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>Seaport District</td>\n",
" <td>1 Seaport Lane, Boston, MA 02210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>Longwood Medical Area</td>\n",
" <td>75 Francis Street, Boston, MA 02115</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>Kenmore Square</td>\n",
" <td>645 Beacon Street, Boston, MA 02215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>Allston</td>\n",
" <td>85 Brighton Avenue, Boston, MA 02134</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>Back Bay</td>\n",
" <td>800 Boylston Street, Boston, MA 02199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>Bay Village</td>\n",
" <td>10 Church Street, Boston, MA 02116</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>Beacon Hill</td>\n",
" <td>45 Beacon Street, Boston, MA 02108</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>Brighton</td>\n",
" <td>1500 Commonwealth Avenue, Boston, MA 02135</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>Charlestown</td>\n",
" <td>55 Constitution Road, Boston, MA 02129</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>Chinatown–Leather District</td>\n",
" <td>88 Kneeland Street, Boston, MA 02111</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>Dorchester</td>\n",
" <td>1100 Washington Street, Boston, MA 02124</td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>Downtown</td>\n",
" <td>100 Federal Street, Boston, MA 02110</td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>East Boston</td>\n",
" <td>20 Maverick Square, Boston, MA 02128</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>Fenway–Kenmore</td>\n",
" <td>70 Brookline Avenue, Boston, MA 02215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>Hyde Park</td>\n",
" <td>1250 Hyde Park Avenue, Boston, MA 02136</td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>Jamaica Plain</td>\n",
" <td>500 Centre Street, Boston, MA 02130</td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>Mattapan</td>\n",
" <td>1200 Blue Hill Avenue, Boston, MA 02126</td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
" <td>Mission Hill</td>\n",
" <td>800 Huntington Avenue, Boston, MA 02115</td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
" <td>North End</td>\n",
" <td>300 Hanover Street, Boston, MA 02113</td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>Roslindale</td>\n",
" <td>4500 Washington Street, Boston, MA 02131</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>Roxbury</td>\n",
" <td>2200 Washington Street, Boston, MA 02119</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>South Boston</td>\n",
" <td>250 Northern Avenue, Boston, MA 02210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>South End</td>\n",
" <td>600 Tremont Street, Boston, MA 02118</td>\n",
" </tr>\n",
" <tr>\n",
" <th>45</th>\n",
" <td>West End</td>\n",
" <td>120 Staniford Street, Boston, MA 02114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>West Roxbury</td>\n",
" <td>2000 Centre Street, Boston, MA 02132</td>\n",
" </tr>\n",
" <tr>\n",
" <th>47</th>\n",
" <td>Seaport District</td>\n",
" <td>5 Fan Pier Boulevard, Boston, MA 02210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>48</th>\n",
" <td>Longwood Medical Area</td>\n",
" <td>99 Brookline Avenue, Boston, MA 02215</td>\n",
" </tr>\n",
" <tr>\n",
" <th>49</th>\n",
" <td>Kenmore Square</td>\n",
" <td>700 Commonwealth Avenue, Boston, MA 02215</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Neighborhood Address\n",
"0 Allston 123 Harvard Avenue, Boston, MA 02134\n",
"1 Back Bay 500 Boylston Street, Boston, MA 02116\n",
"2 Bay Village 15 Fayette Street, Boston, MA 02116\n",
"3 Beacon Hill 21 Charles Street, Boston, MA 02114\n",
"4 Brighton 370 Washington Street, Boston, MA 02135\n",
"5 Charlestown 1 Monument Square, Boston, MA 02129\n",
"6 Chinatown–Leather District 66 Harrison Avenue, Boston, MA 02111\n",
"7 Dorchester 1450 Dorchester Avenue, Boston, MA 02122\n",
"8 Downtown 1 Washington Mall, Boston, MA 02108\n",
"9 East Boston 946 Bennington Street, Boston, MA 02128\n",
"10 Fenway–Kenmore 4 Yawkey Way, Boston, MA 02215\n",
"11 Hyde Park 1179 River Street, Boston, MA 02136\n",
"12 Jamaica Plain 403 Centre Street, Boston, MA 02130\n",
"13 Mattapan 1575 Blue Hill Avenue, Boston, MA 02126\n",
"14 Mission Hill 1575 Tremont Street, Boston, MA 02120\n",
"15 North End 226 Hanover Street, Boston, MA 02113\n",
"16 Roslindale 4195 Washington Street, Boston, MA 02131\n",
"17 Roxbury 2101 Washington Street, Boston, MA 02119\n",
"18 South Boston 200 Seaport Boulevard, Boston, MA 02210\n",
"19 South End 541 Tremont Street, Boston, MA 02116\n",
"20 West End 100 Blossom Street, Boston, MA 02114\n",
"21 West Roxbury 1885 Centre Street, Boston, MA 02132\n",
"22 Seaport District 1 Seaport Lane, Boston, MA 02210\n",
"23 Longwood Medical Area 75 Francis Street, Boston, MA 02115\n",
"24 Kenmore Square 645 Beacon Street, Boston, MA 02215\n",
"25 Allston 85 Brighton Avenue, Boston, MA 02134\n",
"26 Back Bay 800 Boylston Street, Boston, MA 02199\n",
"27 Bay Village 10 Church Street, Boston, MA 02116\n",
"28 Beacon Hill 45 Beacon Street, Boston, MA 02108\n",
"29 Brighton 1500 Commonwealth Avenue, Boston, MA 02135\n",
"30 Charlestown 55 Constitution Road, Boston, MA 02129\n",
"31 Chinatown–Leather District 88 Kneeland Street, Boston, MA 02111\n",
"32 Dorchester 1100 Washington Street, Boston, MA 02124\n",
"33 Downtown 100 Federal Street, Boston, MA 02110\n",
"34 East Boston 20 Maverick Square, Boston, MA 02128\n",
"35 Fenway–Kenmore 70 Brookline Avenue, Boston, MA 02215\n",
"36 Hyde Park 1250 Hyde Park Avenue, Boston, MA 02136\n",
"37 Jamaica Plain 500 Centre Street, Boston, MA 02130\n",
"38 Mattapan 1200 Blue Hill Avenue, Boston, MA 02126\n",
"39 Mission Hill 800 Huntington Avenue, Boston, MA 02115\n",
"40 North End 300 Hanover Street, Boston, MA 02113\n",
"41 Roslindale 4500 Washington Street, Boston, MA 02131\n",
"42 Roxbury 2200 Washington Street, Boston, MA 02119\n",
"43 South Boston 250 Northern Avenue, Boston, MA 02210\n",
"44 South End 600 Tremont Street, Boston, MA 02118\n",
"45 West End 120 Staniford Street, Boston, MA 02114\n",
"46 West Roxbury 2000 Centre Street, Boston, MA 02132\n",
"47 Seaport District 5 Fan Pier Boulevard, Boston, MA 02210\n",
"48 Longwood Medical Area 99 Brookline Avenue, Boston, MA 02215\n",
"49 Kenmore Square 700 Commonwealth Avenue, Boston, MA 02215"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"addy = pd.read_csv(\"boston_50_addresses.csv\")\n",
"addy"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"123 Harvard Avenue, Boston, MA 02134\". What schools can he attend?\n",
"Response: Based on your location and student information, these schools are available:\n",
"\n",
"1. Baldwin Early Learning Pilot Academy\n",
" Address: 121 Corey Rd Brighton, MA 02135\n",
"\n",
"2. Dudley Street Neighborhood Charter School\n",
" Address: 6 Shirley St Roxbury, MA 02119\n",
"\n",
"3. Edison Elementary School\n",
" Address: 60 Glenmont Rd Brighton, MA 02135\n",
"\n",
"4. Gardner Pilot Academy\n",
" Address: 30 Athol St Allston, MA 02134\n",
"\n",
"5. Hennigan Elementary School\n",
" Address: 200 Heath St Jamaica Plain, MA 02130\n",
"\n",
"6. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"7. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"8. John F Kennedy Elementary School\n",
" Address: 7 Bolster St Jamaica Plain, MA 02130\n",
"\n",
"9. Lyon Elementary School\n",
" Address: 50 Beechcroft St Brighton, MA 02135\n",
"\n",
"10. Mario Umana Academy\n",
" Address: 312 Border St East Boston, MA 02128\n",
"\n",
"\n",
"There are 14 eligible schools in total. For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"500 Boylston Street, Boston, MA 02116\". What schools can he attend?\n",
"Response: Based on your location and student information, these schools are available:\n",
"\n",
"1. Blackstone Elementary School\n",
" Address: 380 Shawmut Ave South End, MA 02118\n",
"\n",
"2. Condon K-8 School\n",
" Address: 200 D St South Boston, MA 02127\n",
"\n",
"3. Dudley Street Neighborhood Charter School\n",
" Address: 6 Shirley St Roxbury, MA 02119\n",
"\n",
"4. East Boston Early Education Center\n",
" Address: 135 Gove St East Boston, MA 02128\n",
"\n",
"5. Edison Elementary School\n",
" Address: 60 Glenmont Rd Brighton, MA 02135\n",
"\n",
"6. Eliot K-8 Innovation School\n",
" Address: 16 Charter St North End, MA 02113\n",
"\n",
"7. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"8. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"9. Mario Umana Academy\n",
" Address: 312 Border St East Boston, MA 02128\n",
"\n",
"10. Mason Elementary School\n",
" Address: 150 Norfolk Ave Roxbury, MA 02119\n",
"\n",
"\n",
"There are 15 eligible schools in total. For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"15 Fayette Street, Boston, MA 02116\". What schools can he attend?\n",
"Response: Based on your location and student information, these schools are available:\n",
"\n",
"1. Blackstone Elementary School\n",
" Address: 380 Shawmut Ave South End, MA 02118\n",
"\n",
"2. Condon K-8 School\n",
" Address: 200 D St South Boston, MA 02127\n",
"\n",
"3. Dudley Street Neighborhood Charter School\n",
" Address: 6 Shirley St Roxbury, MA 02119\n",
"\n",
"4. East Boston Early Education Center\n",
" Address: 135 Gove St East Boston, MA 02128\n",
"\n",
"5. Edison Elementary School\n",
" Address: 60 Glenmont Rd Brighton, MA 02135\n",
"\n",
"6. Eliot K-8 Innovation School\n",
" Address: 16 Charter St North End, MA 02113\n",
"\n",
"7. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"8. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"9. Mario Umana Academy\n",
" Address: 312 Border St East Boston, MA 02128\n",
"\n",
"10. Mason Elementary School\n",
" Address: 150 Norfolk Ave Roxbury, MA 02119\n",
"\n",
"\n",
"There are 16 eligible schools in total. For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"21 Charles Street, Boston, MA 02114\". What schools can he attend?\n",
"API error: API request failed with status code 400: {\"message\":\"Could not find google place ID for address\"}\n",
"Response: I apologize, but I encountered an error searching for schools: API request failed with status code 400: {\"message\":\"Could not find google place ID for address\"}\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"370 Washington Street, Boston, MA 02135\". What schools can he attend?\n",
"API error: API request failed with status code 400: {\"message\":\"Could not find google place ID for address\"}\n",
"Response: I apologize, but I encountered an error searching for schools: API request failed with status code 400: {\"message\":\"Could not find google place ID for address\"}\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"1 Monument Square, Boston, MA 02129\". What schools can he attend?\n",
"API error: API request failed with status code 500: {\"message\":\"HTTP error! status: 500\"}\n",
"Response: I apologize, but I encountered an error searching for schools: API request failed with status code 500: {\"message\":\"HTTP error! status: 500\"}\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"66 Harrison Avenue, Boston, MA 02111\". What schools can he attend?\n",
"Response: Based on your location and student information, these schools are available:\n",
"\n",
"1. Blackstone Elementary School\n",
" Address: 380 Shawmut Ave South End, MA 02118\n",
"\n",
"2. Condon K-8 School\n",
" Address: 200 D St South Boston, MA 02127\n",
"\n",
"3. Dudley Street Neighborhood Charter School\n",
" Address: 6 Shirley St Roxbury, MA 02119\n",
"\n",
"4. East Boston Early Education Center\n",
" Address: 135 Gove St East Boston, MA 02128\n",
"\n",
"5. Edison Elementary School\n",
" Address: 60 Glenmont Rd Brighton, MA 02135\n",
"\n",
"6. Eliot K-8 Innovation School\n",
" Address: 16 Charter St North End, MA 02113\n",
"\n",
"7. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"8. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"9. Mario Umana Academy\n",
" Address: 312 Border St East Boston, MA 02128\n",
"\n",
"10. Perkins Elementary School\n",
" Address: 50 Rev Burke St South Boston, MA 02127\n",
"\n",
"\n",
"There are 14 eligible schools in total. For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"1450 Dorchester Avenue, Boston, MA 02122\". What schools can he attend?\n",
"Response: Based on your location and student information, these schools are available:\n",
"\n",
"1. Dever Elementary School\n",
" Address: 325 Mt Vernon St Dorchester, MA 02125\n",
"\n",
"2. Dudley Street Neighborhood Charter School\n",
" Address: 6 Shirley St Roxbury, MA 02119\n",
"\n",
"3. Everett Elementary School\n",
" Address: 71 Pleasant St Dorchester, MA 02125\n",
"\n",
"4. Haynes Early Education Center\n",
" Address: 263 Blue Hill Ave Roxbury, MA 02119\n",
"\n",
"5. Henderson K-12 Inclusion School (Lower)\n",
" Address: 1669 Dorchester Ave Dorchester, MA 02122\n",
"\n",
"6. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"7. Holmes Elementary School\n",
" Address: 40 School St Dorchester, MA 02124\n",
"\n",
"8. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"9. Kenny Elementary School\n",
" Address: 19 Oakton Ave Dorchester, MA 02122\n",
"\n",
"10. King Elementary School\n",
" Address: 77 Lawrence Ave Dorchester, MA 02121\n",
"\n",
"\n",
"There are 22 eligible schools in total. For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"1 Washington Mall, Boston, MA 02108\". What schools can he attend?\n",
"API error: API request failed with status code 500: {\"message\":\"HTTP error! status: 500\"}\n",
"Response: I apologize, but I encountered an error searching for schools: API request failed with status code 500: {\"message\":\"HTTP error! status: 500\"}\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"946 Bennington Street, Boston, MA 02128\". What schools can he attend?\n",
"Response: Based on your location and student information, these schools are available:\n",
"\n",
"1. Adams Elementary School\n",
" Address: 165 Webster St East Boston, MA 02128\n",
"\n",
"2. Bradley Elementary School\n",
" Address: 110 Beachview Rd East Boston, MA 02128\n",
"\n",
"3. Condon K-8 School\n",
" Address: 200 D St South Boston, MA 02127\n",
"\n",
"4. Dante Alighieri Montessori School\n",
" Address: 37 Gove St East Boston, MA 02128\n",
"\n",
"5. Dudley Street Neighborhood Charter School\n",
" Address: 6 Shirley St Roxbury, MA 02119\n",
"\n",
"6. East Boston Early Education Center\n",
" Address: 135 Gove St East Boston, MA 02128\n",
"\n",
"7. Guild Elementary School\n",
" Address: 195 Leyden St East Boston, MA 02128\n",
"\n",
"8. Harvard-Kent Elementary School\n",
" Address: 50 Bunker Hill St Charlestown, MA 02129\n",
"\n",
"9. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"10. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"\n",
"There are 18 eligible schools in total. For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n",
"\n",
"Question: I'm looking for schools my child is eligible to attend. Our address is \"4 Yawkey Way, Boston, MA 02215\". What schools can he attend?\n"
]
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mKeyboardInterrupt\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[43]\u001b[39m\u001b[32m, line 16\u001b[39m\n\u001b[32m 13\u001b[39m test_question = \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mI\u001b[39m\u001b[33m'\u001b[39m\u001b[33mm looking for schools my child is eligible to attend. Our address is \u001b[39m\u001b[38;5;132;01m{\u001b[39;00maddress\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m. What schools can he attend?\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 15\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33mQuestion: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtest_question\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m---> \u001b[39m\u001b[32m16\u001b[39m response = \u001b[43mchatbot\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget_response\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtest_question\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 17\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mResponse: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m 18\u001b[39m data[\u001b[33m\"\u001b[39m\u001b[33mAddress\u001b[39m\u001b[33m\"\u001b[39m].append(address)\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/src/chat.py:619\u001b[39m, in \u001b[36mSchoolChatbot.get_response\u001b[39m\u001b[34m(self, user_input, history)\u001b[39m\n\u001b[32m 615\u001b[39m missing = \u001b[38;5;28mself\u001b[39m.determine_missing_info()\n\u001b[32m 617\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m missing:\n\u001b[32m 618\u001b[39m \u001b[38;5;66;03m# We have all the info we need, proceed with search\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m619\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43msearch_eligible_schools\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 620\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 621\u001b[39m \u001b[38;5;66;03m# Ask for the first missing piece of information\u001b[39;00m\n\u001b[32m 622\u001b[39m first_missing = missing[\u001b[32m0\u001b[39m]\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/src/chat.py:549\u001b[39m, in \u001b[36mSchoolChatbot.search_eligible_schools\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 546\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mTo find eligible schools, I still need your \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33m, \u001b[39m\u001b[33m'\u001b[39m.join(missing)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 548\u001b[39m \u001b[38;5;66;03m# Call the API to find eligible schools using the retrieved values\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m549\u001b[39m results = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43meligibility_api\u001b[49m\u001b[43m.\u001b[49m\u001b[43mfind_eligible_schools\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 550\u001b[39m \u001b[43m \u001b[49m\u001b[43mgrade_id\u001b[49m\u001b[43m=\u001b[49m\u001b[43mcurrent_grade\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 551\u001b[39m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m=\u001b[49m\u001b[43mcurrent_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 552\u001b[39m \u001b[43m \u001b[49m\u001b[43mlanguage_id\u001b[49m\u001b[43m=\u001b[49m\u001b[43mcurrent_language\u001b[49m\n\u001b[32m 553\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 555\u001b[39m \u001b[38;5;66;03m# Process results\u001b[39;00m\n\u001b[32m 556\u001b[39m eligible_schools = results.get(\u001b[33m\"\u001b[39m\u001b[33mschools\u001b[39m\u001b[33m\"\u001b[39m, [])\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/src/eligibility_api.py:116\u001b[39m, in \u001b[36mEligibilityAPI.find_eligible_schools\u001b[39m\u001b[34m(self, grade_id, address, language_id)\u001b[39m\n\u001b[32m 92\u001b[39m \u001b[38;5;250m\u001b[39m\u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 93\u001b[39m \u001b[33;03mFind eligible schools based on student details.\u001b[39;00m\n\u001b[32m 94\u001b[39m \u001b[33;03m\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 105\u001b[39m \u001b[33;03m Exception: If the API request fails\u001b[39;00m\n\u001b[32m 106\u001b[39m \u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 107\u001b[39m payload = {\n\u001b[32m 108\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mapplicationType\u001b[39m\u001b[33m\"\u001b[39m: \u001b[33m\"\u001b[39m\u001b[33mExplore\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 109\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mquestionIdToAnswer\u001b[39m\u001b[33m\"\u001b[39m: {\n\u001b[32m (...)\u001b[39m\u001b[32m 113\u001b[39m }\n\u001b[32m 114\u001b[39m }\n\u001b[32m--> \u001b[39m\u001b[32m116\u001b[39m response = \u001b[43mrequests\u001b[49m\u001b[43m.\u001b[49m\u001b[43mpost\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mBASE_URL\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mjson\u001b[49m\u001b[43m=\u001b[49m\u001b[43mpayload\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 118\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m response.ok:\n\u001b[32m 119\u001b[39m api_response = response.json()\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/requests/api.py:115\u001b[39m, in \u001b[36mpost\u001b[39m\u001b[34m(url, data, json, **kwargs)\u001b[39m\n\u001b[32m 103\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mpost\u001b[39m(url, data=\u001b[38;5;28;01mNone\u001b[39;00m, json=\u001b[38;5;28;01mNone\u001b[39;00m, **kwargs):\n\u001b[32m 104\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33mr\u001b[39m\u001b[33;03m\"\"\"Sends a POST request.\u001b[39;00m\n\u001b[32m 105\u001b[39m \n\u001b[32m 106\u001b[39m \u001b[33;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 112\u001b[39m \u001b[33;03m :rtype: requests.Response\u001b[39;00m\n\u001b[32m 113\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m115\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mpost\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mjson\u001b[49m\u001b[43m=\u001b[49m\u001b[43mjson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/requests/api.py:59\u001b[39m, in \u001b[36mrequest\u001b[39m\u001b[34m(method, url, **kwargs)\u001b[39m\n\u001b[32m 55\u001b[39m \u001b[38;5;66;03m# By using the 'with' statement we are sure the session is closed, thus we\u001b[39;00m\n\u001b[32m 56\u001b[39m \u001b[38;5;66;03m# avoid leaving sockets open which can trigger a ResourceWarning in some\u001b[39;00m\n\u001b[32m 57\u001b[39m \u001b[38;5;66;03m# cases, and look like a memory leak in others.\u001b[39;00m\n\u001b[32m 58\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m sessions.Session() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[32m---> \u001b[39m\u001b[32m59\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msession\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m=\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/requests/sessions.py:589\u001b[39m, in \u001b[36mSession.request\u001b[39m\u001b[34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[39m\n\u001b[32m 584\u001b[39m send_kwargs = {\n\u001b[32m 585\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mtimeout\u001b[39m\u001b[33m\"\u001b[39m: timeout,\n\u001b[32m 586\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mallow_redirects\u001b[39m\u001b[33m\"\u001b[39m: allow_redirects,\n\u001b[32m 587\u001b[39m }\n\u001b[32m 588\u001b[39m send_kwargs.update(settings)\n\u001b[32m--> \u001b[39m\u001b[32m589\u001b[39m resp = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 591\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/requests/sessions.py:703\u001b[39m, in \u001b[36mSession.send\u001b[39m\u001b[34m(self, request, **kwargs)\u001b[39m\n\u001b[32m 700\u001b[39m start = preferred_clock()\n\u001b[32m 702\u001b[39m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m703\u001b[39m r = \u001b[43madapter\u001b[49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 705\u001b[39m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[32m 706\u001b[39m elapsed = preferred_clock() - start\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/requests/adapters.py:667\u001b[39m, in \u001b[36mHTTPAdapter.send\u001b[39m\u001b[34m(self, request, stream, timeout, verify, cert, proxies)\u001b[39m\n\u001b[32m 664\u001b[39m timeout = TimeoutSauce(connect=timeout, read=timeout)\n\u001b[32m 666\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m667\u001b[39m resp = \u001b[43mconn\u001b[49m\u001b[43m.\u001b[49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 668\u001b[39m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m.\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 669\u001b[39m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m=\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 670\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m.\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 671\u001b[39m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m.\u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 672\u001b[39m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 673\u001b[39m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 674\u001b[39m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 675\u001b[39m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 676\u001b[39m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 677\u001b[39m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 678\u001b[39m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m=\u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 679\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 681\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[32m 682\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request=request)\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/urllib3/connectionpool.py:787\u001b[39m, in \u001b[36mHTTPConnectionPool.urlopen\u001b[39m\u001b[34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[39m\n\u001b[32m 784\u001b[39m response_conn = conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 786\u001b[39m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m787\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 788\u001b[39m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 789\u001b[39m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 790\u001b[39m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 791\u001b[39m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 792\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 793\u001b[39m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m=\u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 794\u001b[39m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m=\u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 795\u001b[39m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[43m=\u001b[49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 796\u001b[39m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[43m=\u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 797\u001b[39m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[43m=\u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 798\u001b[39m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 799\u001b[39m \u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 800\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 802\u001b[39m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n\u001b[32m 803\u001b[39m clean_exit = \u001b[38;5;28;01mTrue\u001b[39;00m\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/urllib3/connectionpool.py:534\u001b[39m, in \u001b[36mHTTPConnectionPool._make_request\u001b[39m\u001b[34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[39m\n\u001b[32m 532\u001b[39m \u001b[38;5;66;03m# Receive the response from the server\u001b[39;00m\n\u001b[32m 533\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m534\u001b[39m response = \u001b[43mconn\u001b[49m\u001b[43m.\u001b[49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 535\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m (BaseSSLError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[32m 536\u001b[39m \u001b[38;5;28mself\u001b[39m._raise_timeout(err=e, url=url, timeout_value=read_timeout)\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Git/6.s041-chatbot/6s041_chatbot/lib/python3.13/site-packages/urllib3/connection.py:516\u001b[39m, in \u001b[36mHTTPConnection.getresponse\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 513\u001b[39m _shutdown = \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m.sock, \u001b[33m\"\u001b[39m\u001b[33mshutdown\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 515\u001b[39m \u001b[38;5;66;03m# Get the response from http.client.HTTPConnection\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m516\u001b[39m httplib_response = \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m.\u001b[49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 518\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 519\u001b[39m assert_header_parsing(httplib_response.msg)\n",
"\u001b[36mFile \u001b[39m\u001b[32m/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py:1428\u001b[39m, in \u001b[36mHTTPConnection.getresponse\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1426\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 1427\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1428\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1429\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n\u001b[32m 1430\u001b[39m \u001b[38;5;28mself\u001b[39m.close()\n",
"\u001b[36mFile \u001b[39m\u001b[32m/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py:331\u001b[39m, in \u001b[36mHTTPResponse.begin\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 329\u001b[39m \u001b[38;5;66;03m# read until we get a non-100 response\u001b[39;00m\n\u001b[32m 330\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m331\u001b[39m version, status, reason = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 332\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m status != CONTINUE:\n\u001b[32m 333\u001b[39m \u001b[38;5;28;01mbreak\u001b[39;00m\n",
"\u001b[36mFile \u001b[39m\u001b[32m/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py:292\u001b[39m, in \u001b[36mHTTPResponse._read_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 291\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m_read_status\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[32m--> \u001b[39m\u001b[32m292\u001b[39m line = \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mfp\u001b[49m\u001b[43m.\u001b[49m\u001b[43mreadline\u001b[49m\u001b[43m(\u001b[49m\u001b[43m_MAXLINE\u001b[49m\u001b[43m \u001b[49m\u001b[43m+\u001b[49m\u001b[43m \u001b[49m\u001b[32;43m1\u001b[39;49m\u001b[43m)\u001b[49m, \u001b[33m\"\u001b[39m\u001b[33miso-8859-1\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 293\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(line) > _MAXLINE:\n\u001b[32m 294\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m LineTooLong(\u001b[33m\"\u001b[39m\u001b[33mstatus line\u001b[39m\u001b[33m\"\u001b[39m)\n",
"\u001b[36mFile \u001b[39m\u001b[32m/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/socket.py:719\u001b[39m, in \u001b[36mSocketIO.readinto\u001b[39m\u001b[34m(self, b)\u001b[39m\n\u001b[32m 717\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\u001b[33m\"\u001b[39m\u001b[33mcannot read from timed out object\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 718\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m719\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sock\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrecv_into\u001b[49m\u001b[43m(\u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 720\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m timeout:\n\u001b[32m 721\u001b[39m \u001b[38;5;28mself\u001b[39m._timeout_occurred = \u001b[38;5;28;01mTrue\u001b[39;00m\n",
"\u001b[36mFile \u001b[39m\u001b[32m/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ssl.py:1304\u001b[39m, in \u001b[36mSSLSocket.recv_into\u001b[39m\u001b[34m(self, buffer, nbytes, flags)\u001b[39m\n\u001b[32m 1300\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m flags != \u001b[32m0\u001b[39m:\n\u001b[32m 1301\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[32m 1302\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mnon-zero flags not allowed in calls to recv_into() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[33m\"\u001b[39m %\n\u001b[32m 1303\u001b[39m \u001b[38;5;28mself\u001b[39m.\u001b[34m__class__\u001b[39m)\n\u001b[32m-> \u001b[39m\u001b[32m1304\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnbytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1305\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1306\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m().recv_into(buffer, nbytes, flags)\n",
"\u001b[36mFile \u001b[39m\u001b[32m/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ssl.py:1138\u001b[39m, in \u001b[36mSSLSocket.read\u001b[39m\u001b[34m(self, len, buffer)\u001b[39m\n\u001b[32m 1136\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 1137\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m buffer \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1138\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sslobj\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1139\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1140\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m._sslobj.read(\u001b[38;5;28mlen\u001b[39m)\n",
"\u001b[31mKeyboardInterrupt\u001b[39m: "
]
}
],
"source": [
"## Run tests of all the addresses and get all the responses stored in a csv file.\n",
"data = {\"Address\": [], \"Result\": []}\n",
"for address in addy[\"Address\"]:\n",
" \"\"\"\n",
" Create chatbot instance using chat.py\n",
" \"\"\"\n",
" chatbot = SchoolChatbot()\n",
"\n",
" \"\"\"\n",
" Test out generating some responses from the chatbot.\n",
" Inference time\n",
" \"\"\"\n",
" test_question = f\"I'm looking for schools my child is eligible to attend. Our address is {address}. What schools can he attend?\"\n",
"\n",
" print(f\"\\nQuestion: {test_question}\")\n",
" response = chatbot.get_response(test_question)\n",
" print(f\"Response: {response}\")\n",
" data[\"Address\"].append(address)\n",
" data[\"Result\"].append(response)\n",
"\n",
"results = pd.DataFrame(data)\n",
"results.to_csv(\"location_results.csv\", index=False)\n"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"200 Seaport Boulevard, Boston, MA 02210\n",
"Based on your location and student information, these schools are available:\n",
"\n",
"1. Hernandez Elementary School\n",
" Address: 61 School St Roxbury, MA 02119\n",
"\n",
"2. Hurley K-8 School\n",
" Address: 70 Worcester St South End, MA 02118\n",
"\n",
"3. Mario Umana Academy\n",
" Address: 312 Border St East Boston, MA 02128\n",
"\n",
"4. Sarah Greenwood K-8 School\n",
" Address: 186 Glenway Street Dorchester, MA 02121\n",
"\n",
"For more details, please visit: https://boston.explore.avela.org/\n",
"\n",
"You can ask me for more information about any specific school by name or number (e.g., 'Tell me more about #3').\n"
]
}
],
"source": [
"n = 18\n",
"print(results[\"Address\"][n])\n",
"print(results[\"Result\"][n])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "6s041_chatbot",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|