All jobs / AI engineer / LLM APIs

AI engineer interview question · 1–3 years

A service asks the model for an order as JSON and deserialises the reply straight into the order object. Now and then the parse fails, and once it created an order for a product that does not exist.

What is missing between the model’s reply and your order object?

The strongest answer

Validation. I use schema-constrained output where the provider has it, then check the parsed object in code — types, ranges, ids that must exist — and treat truncated or refused replies as an error path

Why it works

Exactly — a schema makes the shape reliable, not the content. Model output is untrusted input like any other, and a reply cut off at the output limit is not valid JSON.

What a good answer covers

Answers that fall short

Who gets asked this

More LLM APIs questions