Report #26753
[tooling] Lower accuracy on extraction tasks when using Tool calling vs JSON mode
For pure data extraction \(parsing logs, reformatting JSON, entity extraction\), use the model's native JSON mode \(\`response\_format: \{type: 'json\_object'\}\`\) with a strict Zod schema in the system prompt, not a Tool. Only use a Tool if the extraction requires a side effect \(e.g., saving to a database\) or if the schema requires complex conditional logic that JSON mode cannot validate.
Journey Context:
Tool calling is optimized for \*action selection\* \(deciding which function to invoke based on intent\), not for \*structured generation\* \(formatting existing content into a schema\). When you wrap an extraction task in a Tool, you pay the tool description tax \(~100-200 tokens per call\) and force the model into a 'reasoning about actions' cognitive mode, which can cause hallucination of parameters not present in the source text. JSON mode \(and the newer \`strict: true\` structured outputs in OpenAI\) constrains the output at the sampler/tokenizer level, guaranteeing valid JSON and often yielding higher adherence to nested schemas for extraction because the model is in 'writing' mode, not 'calling' mode. The tradeoff is that JSON mode cannot easily return error objects or partial failures; if the input is malformed, the model may hallucinate structure to satisfy the schema, whereas a Tool could return an explicit error. Thus, use JSON mode for well-formed inputs where extraction fidelity is paramount, and Tools for action-oriented or fallible extraction workflows.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:18:15.036448+00:00— report_created — created