OAI-SE Structured Outputs & Strict JSON Schemas HARD
PRODUCTION SCENARIO
Quarrystone's search backend accepts a proprietary filter language such as region:eu AND (price<40 OR tier:basic), with nested groups, which is plain text rather than JSON. A function tool with a single string parameter produces syntactically invalid filters about one call in twelve.

Which tool design constrains the model's output to the filter language?

Answering here is anonymous. Nothing is saved unless you sign in.

Show answer and explanation

Answer: Define a custom tool with a grammar format written in Lark syntax that describes the filter language

Custom tools let the model pass an arbitrary string as tool input, and attaching a context-free grammar in Lark syntax constrains that string to the language you define, nested groups included. Strict JSON validation only checks the object's shape, not the text inside a string, and neither descriptions nor tool_choice enforce syntax.
Free

Keep practicing OAI-SE

undefined original OAI-SE practice questions, each with an explanation and a source link. No account needed.

Start free practice set → Timed, explained, free