Questão 1 de 10Design Applications
Downstream code must parse the model output as JSON with keys sentiment and reason. Which prompt design is most reliable?
- Ask for a short free-text answer that mentions the sentiment and the reason, and extract both fields with regular expressions (or string/keyword matching)
- State the exact JSON schema, instruct to return only JSON with no prose, and include one or two examples (or use structured output/tool calling)
- Ask the model to write a Python script that prints the JSON, run the script on the driver, and have the downstream code parse its printed output
- List the two keys at the end of the prompt, raise the temperature to 1.0 so the model explores formats, and keep the first response that parses
Ver respostaEsconder resposta
Resposta certa: B. State the exact JSON schema, instruct to return only JSON with no prose, and include one or two examples (or use structured output/tool calling)
Por quê: Explicit format instructions plus examples maximise compliance; schema-enforced structured output removes syntax errors entirely.
Docs: "Structured outputs on Databricks"


