Difference in accuracy between ChatGPT and API-based agents when extracting tables

Hi everyone,

I’ve noticed a significant divergence between ChatGPT’s ability to extract and structure tables (for example, from a “large” table in a document) and the behavior of custom agents I’ve built using the OpenAI API (o4-mini model).

ChatGPT extracts and formats tables cleanly and accurately.
But my API-based agents are slower and often skip rows, add hallucinated data, or break the table structure when formatting to JSON.

I understand ChatGPT likely runs on top of an internal orchestration layer or additional parsing tools, while the API gives access only to the base model. Still, I’d like to know if others have found reliable ways to improve accuracy in this type of structured data extraction.

:light_bulb: Possible methods I’ve heard about

  • Splitting the document into chunks before feeding it to the model
  • Creating an agent that dynamically generates code to parse and reformat the table content
  • Enforcing a strict Pydantic schema with retries until valid JSON is returned

I haven’t tested these yet, so if anyone thinks these methods are both fast and accurate,
it would be great if you could kindly share your code or working examples.

Thanks in advance!