<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mustafa Buğra Sözeri</title>
    <description>The latest articles on DEV Community by Mustafa Buğra Sözeri (@mustafa_buraszeri_1e27).</description>
    <link>https://dev.to/mustafa_buraszeri_1e27</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4245237%2Faf1ed4a4-692b-47e1-a62f-a56aef47f624.jpg</url>
      <title>DEV Community: Mustafa Buğra Sözeri</title>
      <link>https://dev.to/mustafa_buraszeri_1e27</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mustafa_buraszeri_1e27"/>
    <language>en</language>
    <item>
      <title>Turning PDFs, DOCX and phone photos into quiz questions: what actually broke</title>
      <dc:creator>Mustafa Buğra Sözeri</dc:creator>
      <pubDate>Sun, 15 Nov 2026 00:47:18 +0000</pubDate>
      <link>https://dev.to/mustafa_buraszeri_1e27/turning-pdfs-docx-and-phone-photos-into-quiz-questions-what-actually-broke-1cah</link>
      <guid>https://dev.to/mustafa_buraszeri_1e27/turning-pdfs-docx-and-phone-photos-into-quiz-questions-what-actually-broke-1cah</guid>
      <description>&lt;p&gt;I build SimpleQuizMaker, a tool that turns study material into an editable quiz. The model call takes about five lines. Getting clean input to the model, and keeping its output usable, took everything else. Here's what broke and how we handled it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Don't trust the declared file type
&lt;/h2&gt;

&lt;p&gt;Browsers send whatever MIME type the OS guesses, and an attacker can send anything at all. Every upload is checked against its first bytes before we parse it: &lt;code&gt;%PDF&lt;/code&gt; for PDFs, &lt;code&gt;FF D8 FF&lt;/code&gt; for JPEG, &lt;code&gt;89 50 4E 47&lt;/code&gt; for PNG, &lt;code&gt;PK&lt;/code&gt; or &lt;code&gt;D0 CF&lt;/code&gt; for DOCX/DOC. A file whose bytes don't match its claimed type is rejected. It's twelve bytes of reading, and it removes a whole class of problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. One extractor per input type
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PDF:&lt;/strong&gt; &lt;code&gt;pdf-parse&lt;/code&gt; (v2 switched from a plain function to a class-based API, which broke our first upgrade).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DOCX:&lt;/strong&gt; &lt;code&gt;mammoth&lt;/code&gt; for raw text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Images&lt;/strong&gt; (people photograph worksheets constantly): a vision model call that transcribes the page, with the image capped at about 2 MB before base64 encoding, because base64 inflates it by roughly 1.37x.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;YouTube:&lt;/strong&gt; captions with their timestamps, so a question can point back to the moment in the video.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scanned PDFs&lt;/strong&gt; have no text layer. Detect an empty extraction and tell the user, instead of sending the model an empty prompt that it will happily "answer".&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. JSON mode has a quirk
&lt;/h2&gt;

&lt;p&gt;We ask the model for &lt;code&gt;response_format: { type: "json_object" }&lt;/code&gt;. OpenAI rejects that unless the word "json" appears in the prompt. We have a comment in the code that says "do not reword this sentence away" because someone eventually will. And JSON mode guarantees valid JSON, not your schema, so every response is parsed and validated, and a malformed response fails loudly instead of rendering half a quiz.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Budget before you call, not after
&lt;/h2&gt;

&lt;p&gt;Long inputs plus a 100-question request can get expensive. Before each generation we estimate the cost from input length and expected output tokens for the chosen model, refuse if it would exceed the user's budget, and record the actual usage afterwards. If one feature makes two model calls, both go into the log, because both are billed.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Quality is a prompt problem and a product problem
&lt;/h2&gt;

&lt;p&gt;The prompt asks for distractors built from common misconceptions, which makes a big difference in multiple-choice quality. But the bigger win was product-side: every question is editable before sharing. We stopped trying to make the output perfect and made it cheap to fix.&lt;/p&gt;

&lt;p&gt;If you're building something similar, I'm happy to go deeper on any of these in the comments. The tool is at &lt;a href="https://simplequizmaker.com" rel="noopener noreferrer"&gt;simplequizmaker.com&lt;/a&gt; (free tier available).&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>nextjs</category>
      <category>openai</category>
    </item>
  </channel>
</rss>
