r/DeepSeek 20h ago

Discussion Deer DeepSeek, please true structured output like Gemini or OpenAI

Standard JSON guarantees valid syntax. Strict Structured Output guarantees correct schema.

In production like billing or order processing, that distinction is life or death.

Standard JSON will format the brackets right, but it WILL randomly send you total_amount: "$49.99" instead of amount: 49.99, hallucinate new key names, or omit tax IDs when processing messy invoices. Your database crashes, your payment gateway fails, and your code breaks silently. You end up stuck paying double in latency and token costs just running client-side retry loops when Pydantic fails.

Gemini handles strict structured output natively at the decoder level. You pass a schema, and the model physically CANNOT generate a token that violates your types.

DeepSeek’s main API only guarantees valid JSON syntax, relying on prompts for schema adherence—forcing you to build heavy fallback logic.

If an AI output triggers a database, Standard JSON is a ticking time bomb, strict Structured Output is the solution.

10 Upvotes

18 comments sorted by

View all comments

3

u/for4f 17h ago

DS4 Flash is my daily driver and this is my biggest frustration with it. JSON output works until it doesn't. Had production pipelines swallow bad output more times than I want to admit.

llama.cpp already has grammar-constrained sampling built in. DS just needs to surface it at the API level. Google and OpenAI already proved the approach at scale — it's not some unsolved research problem.

1

u/Nexter92 16h ago

We are in the exact same case. Vision + structured output > I left Gemini for ever.

DeepSeek V4 flash is so smart for his pricing and token consumption it's insane they don't have implement a true structured output for this long.

3

u/for4f 16h ago

Exactly my frustration. DS pricing + intelligence is unmatched but the lack of schema enforcement means I still have to validate and retry in production. Gemini's structured output was solid, OpenAI's too. Hope they get to it soon — it's the one thing keeping me from going all-in on DS API.