ChatGPT, Datasette-Extract, and the US Ham Radio General Exam Question Pool
Β I started a project, ahem, yesterday to 'quickly' see if ChatGPT could read the entire United States general class amateur radio exam question pool into a Datasette instance using the datasette-extract plugin. As of this morning, I haven't been able to coax ChatGPT using the gpt-4-turbo model. I capture my rather raw notes below. The short version of this is that I was never able to get the AI to capture more than 19 questions at a time. I'm hopeful that the pool could be moved into a database table using iterative processes, but for now, I've run out of time for this quick project :)Β
Notes Follow
I'm going to track how easy it is to get the general exam question pool into a database using the Datasette Plugin. I started this endeavor at 20:37 UTC.
Get my already existent OpenAI API key ready to go
20:43: Done. As usual with OpenAI, the hardest part was finding login screens and then the API. Finally did a Google search to find the API.
Install the datasette-extract plugin
I've run into an issue here. I think I have too old of a version of Datasette and Windows can't figure out how to uninstall it
Using cached datasette_extract-0.1a6-py3-none-any.whl (815 kB)
Using cached datasette-1.0a13-py3-none-any.whl (302 kB)
Using cached datasette_secrets-0.1a4-py3-none-any.whl (12 kB)
Installing collected packages: datasette, datasette-secrets, datasette-extract
Β Attempting uninstall: datasette
Β Β Found existing installation: datasette 1.0a3
Β Β Uninstalling datasette-1.0a3:
ERROR: Could not install packages due to an OSError: [WinError 32] The process cannot access the file because it is being used by another process: 'c:\\users\\m3n7es\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\scripts\\datasette.exe'
Check the permissions.
I'll clone a dev environment for the plugin and then run in venv. Time now 21:00.
Still Installing
Adding Table Column Names
21:21 The column names have been defined with hints.Β
idΒ primary key
questionΒ follows a line starting with G ends with '?'
classΒ Defaults to G for every question
subelementΒ A number following G before a second letter
group_indexΒ The letter following subelement's number (G)(\d)(A-Z)(\d\d) Use \$3
group_numberΒ two digit number following group_index (G)(\d)(A-Z)(\d\d) use \$4
answerΒ A single letter between parentheses that indicates the correct answer choice
answer_aΒ next line starting with 'A.'
answer_bΒ next line starting with 'B.'
answer_cΒ next line starting with 'C.'
answer_dΒ next line starting with 'D.'
I added the additional instructions
The questions and answers are in line sorted by headings that contain class (always G), then subelement (a single digit following G), then group_index (a single letter following the subelement), then group_number (a question number within the group_index), then the single letter correct answer enclosed in parentheses. The next line contains the entire question text for the question field. The next four lines in each question contain the four possible answers. The end of each question is denoted by '~~'.
I've copied the entire question pool starting atΒ
into the tool. Now, I'll press 'Extract'
Time is 21:26 UTC
Extracting to Table
Error: Error code: 404 - {'error': {'message': 'The model `gpt-4-turbo` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}
Extraction failed
OK. Looking at My OpenAI account I see:
No gpt-4-turbo. So, that's a bit of a challenge.
OK! The API is like using a Clipper Card on BART. You have to pay up front
I put some money in the account.Β
I'll try to extract again. It's 21:43.
It's Working!!!
[ { "id": 1, "question": "On which HF and/or MF amateur bands are there portions where General class licensees cannot transmit?", "class": "G", "subelement": "G1", "group_index": "A", "group_number": "01", "answer": "C", "answer_a": "60 meters, 30 meters, 17 meters, and 12 meters", "answer_b": "160 meters, 60 meters, 15 meters, and 12 meters", "answer_c": "80 meters, 40 meters, 20 meters, and 15 meters", "answer_d": "80 meters, 20 meters, 15 meters, and 10 meters" }, { "id": 2, "question": "On which of the following bands is phone operation prohibited?",
The engine is still cranking along at 21:47.
And Then </exceeds>
{ "id": 19, "question": "When is it permissible to communicate with amateur stations in countries outside the areas administered by the Federal Communications Commission?", "class": "G", "subelement": "G1", "group_index": "B", "group_number": "08", "answer": "B", "answer_a": "Only when the foreign country has a formal third-party agreement filed with the FCC", "answer_b": "When the contact is with amateurs in any country except those whose administrations have notified the ITU that they object to such communications", "answer_c": "Only when the contact is with amateurs licensed by a country whic... Click to expand ... <exceeds maximum number of characters> ,,groupId,,quizzes,,element,,data,,result,,direct,,[]}]}]}</exceeds>}]}]}</exceeds>}]}]}</exceeds>}]}]}</exceeds>}]}]}</exceeds>}]}]}</exceeds>}]}]}</exceeds>}]}]}</exceeds>}]}]}," } ]
Did I hit the end of my billing envelope?
21:51 No, billing seems fine. I wonder is I need to add the file in as a pdf because of this message:
exceeds maximum number of characters
Trying again with a pdf file
Full Subelement at a time
Error 404
I'll try a db that doesn't revolve around a memory table next.
No Memory Table DBs
Adding Remaining SubElement Group by HandΒ
Can it do two subelement groups?
The rest of the groups in the subelement?
"G1E β Control categories; repeater
regulations; third-party rules; ITU regions; automatically controlled digital
station"
Descriptions Removed
"id": "G1E12",