SnowPro Specialty: Gen AI Question 91
Single answerCOMPLETE Structured OutputsA data engineering team uses Snowflake Cortex COMPLETE to extract support-ticket metadata for downstream SQL analytics. They need every model response to be machine-readable and consistently shaped as: a ticket_category string, a priority string, and a requires_followup boolean. The team wants to reduce brittle post-processing logic and prevent the model from returning free-form prose. Which approach is the MOST appropriate?
- A
Call COMPLETE with a structured output schema that defines the required JSON fields and their types, then instruct the model to return output matching that schema.
- B
Use COMPLETE with a prompt that says "Return valid JSON only" and rely on prompt wording instead of a schema, because COMPLETE guarantees strict JSON compliance from prompting alone.
- C
Store the desired structure in a VARIANT column first, and COMPLETE will infer the required output schema automatically from the target table definition.
- D
Use a larger model in COMPLETE and increase max tokens, because higher-capability models naturally produce more consistent JSON without needing structured output constraints.
Show answer and explanation
Correct answer: A
Explanation
This scenario tests practical use of COMPLETE Structured Outputs in Snowflake Cortex. When downstream systems require deterministic, machine-readable responses, the best practice is to define the expected output structure explicitly rather than relying on prompt engineering alone. Structured Outputs are intended to reduce parsing failures, missing fields, and inconsistent types by constraining the response to a predefined schema. In contrast, simply asking for JSON in the prompt may still produce malformed or nonconforming output. Likewise, storing results in VARIANT is useful for persistence and querying but does not itself enforce generation format, and choosing a larger model does not guarantee schema compliance. This aligns with Snowflake guidance to use schema-constrained outputs when applications depend on predictable JSON from COMPLETE.
- A. Correct.
Correct. For COMPLETE Structured Outputs, the right solution is to provide an explicit schema describing the expected JSON structure and types. This is the most reliable way to constrain responses into a predictable, machine-readable shape for downstream processing. It directly addresses the team's need to reduce brittle parsing logic and avoid free-form responses.
- B. Incorrect.
Incorrect. Asking for "valid JSON only" in the prompt can help, but prompting alone is not the same as using Structured Outputs. Models can still omit fields, change types, or add unexpected text. This option reflects a common misconception that prompt instructions alone provide schema enforcement equivalent to structured output support.
- C. Incorrect.
Incorrect. COMPLETE does not infer a structured output schema from the destination table or VARIANT column automatically. A VARIANT column can store semi-structured data after generation, but it does not constrain model output unless the request itself specifies the required response structure.
- D. Incorrect.
Incorrect. A stronger model or a higher token limit may improve general response quality, but it does not replace schema-based structured outputs. Consistency of field names, presence, and types is best handled by an explicit structured output definition rather than by model size alone.