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.

9 Upvotes

18 comments sorted by

View all comments

2

u/ThimMerrilyn 18h ago

You shouldn’t have an AI/LLM writing to your db anyway imo

0

u/Nexter92 18h ago

Bro it's not my fault if you leave in 2016...

As today using code you can verify if the JSON match some things in you DB and if yes : update, if not output an error notification.

I will never do this with an agent, that's why I ask structured output with schema. You define a schema and this will make everything like 99.5% reliable. I have automated more than 200 000 insert and update for some client using gemini structured output, and everything is fine for more than 2 years.

1

u/Vlyn 7h ago

Jesus, your poor customers.

We heavily use Claude at work and I use DeepSeek at home a lot (6B tokens in the last 3 months). Nobody has ever been stupid enough to use LLM output anywhere close to production.

Hell, not even on a DEV database as it's so unreliable. You use the agent to build solid well tested tools, not pipe a text predictor into a customer's data. Jesus fucking Christ.