{ "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='
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NeighborhoodAddress
0Allston123 Harvard Avenue, Boston, MA 02134
1Back Bay500 Boylston Street, Boston, MA 02116
2Bay Village15 Fayette Street, Boston, MA 02116
3Beacon Hill21 Charles Street, Boston, MA 02114
4Brighton370 Washington Street, Boston, MA 02135
5Charlestown1 Monument Square, Boston, MA 02129
6Chinatown–Leather District66 Harrison Avenue, Boston, MA 02111
7Dorchester1450 Dorchester Avenue, Boston, MA 02122
8Downtown1 Washington Mall, Boston, MA 02108
9East Boston946 Bennington Street, Boston, MA 02128
10Fenway–Kenmore4 Yawkey Way, Boston, MA 02215
11Hyde Park1179 River Street, Boston, MA 02136
12Jamaica Plain403 Centre Street, Boston, MA 02130
13Mattapan1575 Blue Hill Avenue, Boston, MA 02126
14Mission Hill1575 Tremont Street, Boston, MA 02120
15North End226 Hanover Street, Boston, MA 02113
16Roslindale4195 Washington Street, Boston, MA 02131
17Roxbury2101 Washington Street, Boston, MA 02119
18South Boston200 Seaport Boulevard, Boston, MA 02210
19South End541 Tremont Street, Boston, MA 02116
20West End100 Blossom Street, Boston, MA 02114
21West Roxbury1885 Centre Street, Boston, MA 02132
22Seaport District1 Seaport Lane, Boston, MA 02210
23Longwood Medical Area75 Francis Street, Boston, MA 02115
24Kenmore Square645 Beacon Street, Boston, MA 02215
25Allston85 Brighton Avenue, Boston, MA 02134
26Back Bay800 Boylston Street, Boston, MA 02199
27Bay Village10 Church Street, Boston, MA 02116
28Beacon Hill45 Beacon Street, Boston, MA 02108
29Brighton1500 Commonwealth Avenue, Boston, MA 02135
30Charlestown55 Constitution Road, Boston, MA 02129
31Chinatown–Leather District88 Kneeland Street, Boston, MA 02111
32Dorchester1100 Washington Street, Boston, MA 02124
33Downtown100 Federal Street, Boston, MA 02110
34East Boston20 Maverick Square, Boston, MA 02128
35Fenway–Kenmore70 Brookline Avenue, Boston, MA 02215
36Hyde Park1250 Hyde Park Avenue, Boston, MA 02136
37Jamaica Plain500 Centre Street, Boston, MA 02130
38Mattapan1200 Blue Hill Avenue, Boston, MA 02126
39Mission Hill800 Huntington Avenue, Boston, MA 02115
40North End300 Hanover Street, Boston, MA 02113
41Roslindale4500 Washington Street, Boston, MA 02131
42Roxbury2200 Washington Street, Boston, MA 02119
43South Boston250 Northern Avenue, Boston, MA 02210
44South End600 Tremont Street, Boston, MA 02118
45West End120 Staniford Street, Boston, MA 02114
46West Roxbury2000 Centre Street, Boston, MA 02132
47Seaport District5 Fan Pier Boulevard, Boston, MA 02210
48Longwood Medical Area99 Brookline Avenue, Boston, MA 02215
49Kenmore Square700 Commonwealth Avenue, Boston, MA 02215
\n", "" ], "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 }